|
The XPath is fine, that is not where your problem lies. I just made your XML valid and tested it.
If I have trouble with an XPath, I use XSLerator or something similar to test it, and build it one step at a time.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
i think i caught where the problem lies, the problem is me, damn, sorry guys, i didn't paste the exactly code as in my project , its my first time using xml so don't blame me, i think i'm using a namespace, and heres my exactly xml file
<?xml version="1.0" encoding="utf-8"?>
<VoteData xmlns="http://tempuri.org/VoteData.xsd">
<Question id="0" name="do you believe in think tanks?">
<Choice choiceid="1" votes="7" name="Yes">
<Vote ip="192.168.1.1" />
<Vote IP="50.50.20.10" xmlns="" />
<Vote IP="50.50.20.10" xmlns="" />
</Choice>
<Choice choiceid="2" votes="1" name="No">
<Vote IP="50.50.20.10" xmlns="" />
</Choice>
</Question>
<Question id="2" name="bet7eb Sawsan?">
<Choice choiceid="0" votes="0" name="aiwa" />
<Choice choiceid="1" votes="0" name="la2" />
<Choice choiceid="2" votes="0" name="moot" />
<Choice choiceid="3" votes="0" name="ya3ney" />
</Question>
</VoteData>
i didn't think that will be a diffrent while using namespace, so now, what should i change in my C# code to let XPath work ?
sorry guys again and thanx
|
|
|
|
|
Hi all,
I am trying to two things but am unable to do them.
1. I am trying to dynamically add some element in the HTML page with the help of createElement function. I am able to that correctly in IE but not in Netscape 4.7 I refered the javascript reference which says that createElement is not compatible with Netscape. So what is the other way round to do it.
2. Also I am trying to make a div element fixed in the page. That is even if I scroll down the page the div element which is a type of layer does not scroll down. It is possible in IE as:
document.getElementById("divname").style.pixelTop = document.body.scrollTop;
but it is not possible in Netscape4.7 as netscape does not support scrollTop. What is the other way round to do it.
Please help.
|
|
|
|
|
Why in gods name are you still trying to support Nutscrape 4.x? That browser is older than the theory of evolution!
|
|
|
|
|
Due to some urgent requirenments I would make my programme compatible with Netscape 4.7 and also Firefox.
|
|
|
|
|
firefox i can understand, its recent and its reasonably well used - NN4.xx on the other hand is neither.
You will have to see if you can dig up any old NN Javascript docs, as that will guide you on how do deal with the DOM in NN. Most things are possible from a DHTML standpoint, but some just simply are not with that browser.
From memory, you can create a div layer and then write HTML into it using innerHtml property - but you can't createElement like in newer DOM's.
|
|
|
|
|
Your question has absolutely nothing to do with C# or even the .NET Framework and should be asked in the Web Development[^] forum. Even if this is produced from an ASP.NET application written in C#, your question is regarding client-side HTML which ASP.NET has little to do with (and nothing in this case). ASP.NET produces HTML and other content that is downloaded to the client. What happens on the client is totally up to the client, which is why your question belongs in the Web Development forum.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I am a VC 6.0 developer right now i am facing a problem of transfering my image from a dll developed in vc 6.0 to c#
at first i tried to make image from stream in c# and because a can get byte* and size of image from the vc6.0 i got my image this way but now the image was colored (although the original is in black and white) so it actually made the mess with colors of image.
right now i can access Byte* , BITMAPINFOHEADER (also all the variables in bitmapinfoheader) and i want to make system.drawing.bitmap or system.drawing.image from this byte* and assign it to picturebox in c#
please help me out as it is urgent
thanking you in advance and hope for the best results
Arus
|
|
|
|
|
A bitmapinfoheader contains a lot of header info ( funny enough), and also a pointer to the bytes that represent the actual image. One way to do it would be to read the header to find out the size and depth of the image, create a bitmap and copy the bits into it.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi all,
I intend to use the Firebird database engine as the embedded
database engine of our desktop window application written in C#.
Have anyone used it before and is it good enough ? How is it compared
to the Microsoft MSDE data engine in performance, in ease of installation, maintainability....etc.. ?
Thanks
|
|
|
|
|
|
is it possible to retrieve Querystring value of any URL in Winform based application or Console Application?
what i want to retrieve Querystring value and display it in textbox?
thansk in advance
-A
|
|
|
|
|
Of any URL? And what URLs would those be? Internet Explorer isn't the only application that makes use of monikers like URLs. And are you talking about URLs of a running instance of Internet Explorer? If so, you can create an interop assembly (RCW) from shdocvw.dll and use the InternetExplorerClass to either create or access a running instance, from which you can then get the URL in a number of ways like the InternetExplorerClass.LocationURL property.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I have BitArray like this...
bool[] myBools = new bool[8] {true,false,true,false,true,false,true,false,};
BitArray bitArrayBools = new BitArray( myBools );
How do i convert this BitArray to it's integer value ???
Any help will be greatly appreciated !!!!
saleem
|
|
|
|
|
|
Consider the following C# code -
class TestClass
{
public string str;
}
class TestApplication
{
static void Upper1 ( string strParam )
{
strParam = strParam.ToUpper ();
}
static void Upper2( TestClass tc )
{
tc.str = (tc.str) .ToUpper ();
}
static void Main ( string[] args )
{
string s = "lower 1";
Upper1 ( s );
Console.WriteLine ( s );
TestClass tc = new TestClass();
tc.str = "lower 2";
Upper2 ( tc );
Console.WriteLine ( tc.str );
}
}
The output of this code on execution is as follows -
lower 1
LOWER 2
Press any key to continue
I am new to C# and totally confused over the outcome. As far as I know both "string" and "class type" are reference types in C#. When I am calling "Upper1" with a string as parameter it is behaving as if the parameter was passed "by value" and the changes are not visible in the calling function.
But if I wrap the string within a class and pass an instance of the class as argument to "Upper2", it is behaving as expected.
Can anyone help me in solving this mystery?
Thanks a lot in advance.
Siddhartha
|
|
|
|
|
In the first method:
static void Upper1( string strParam )
{
strParam = strParam.ToUpper ();
} strParam is a copy of the reference to a string you pass in. So any modifications you do to strParam in this method gets done to this copy. This copy will not be visible outside its scope. (I'm guessing this is what you expected it to be.)
In the second method:
static void Upper2( TestClass tc )
{
tc.str = tc.str.ToUpper ();
} tc is a copy of the reference to the object you pass in. It is only the reference that is beeing copied (so the reference points at the same single object that was passed in.) Then you alter stuff in that object. This is done to the actual tc object you pass in.
|
|
|
|
|
Thanks Arjan for your prompt reply.
But still I have one doubt in my mind. It looks like inspite of being of "reference type", C# handle strings much like "value types" (May be because string is used in an application as frequently as int, float, char etc.).
Is it true?
|
|
|
|
|
Strings are immutable which basically means they CAN NEVER CHANGE - they are simply replaced in memory. Take this example;
string str1 = "Hello World";
string str2 = "goodbye cruel world";
str1 = "changed".
str2 = "Hello World";
The strings are initially set. When str1 is set to changed it is actually a completely new string - but the string Hello World still exists and is REUSED for str2.
Another example of immutability
str1 = "hello" + " world".
There have just been 3 strings created. "Hello", "World" and then a third string long enough to contain "Hello World" where the originals are copied over to.
This is strange behaviour looking at it from your example above - but not in the world of computers where memory is king and efficient reuse thereof is the ultimate goal.
|
|
|
|
|
Thanks a lot J4amieC. But my question still remains unanswered.
"Does C# handles string much like "value type" even though it is of "reference type" ?".
Clarification will be highly appreciated.
|
|
|
|
|
No it doesn't, string is a reference type.
<br />
class Test<br />
{<br />
<br />
public int x;<br />
}<br />
<br />
void Foo(Test t)<br />
{<br />
t = new Test();<br />
t.x = 2;<br />
}<br />
<br />
void Bar()<br />
{<br />
Test t = new Test();<br />
t.x = 5;<br />
Console.WriteLine(t.x);<br />
Foo(t);<br />
Console.WriteLine(t.x);<br />
}<br />
What do you expect the output to be? It happens to be 5 and 2. If you comment out the t = new Test() in function Foo(), you'll get 2 and 2. So it's not just strings, all reference types have the references passed by value, so reassigning t in Foo() didn't affect the one in Bar(). This is exactly what you experienced with string too.
string s are special in that there is no way you can change a string, so it allows the compiler and the runtime to do some tricks (search for string interning). Basically it allows the runtime to maintain a string pool so that only one copy of a string exists, if you create a string which already exists, you simply get a reference to that string object. Also, string comparison checks if the strings are in the pool and if so, a simple reference check is enough to find if they are equal..
Regards
Senthil
|
|
|
|
|
Hi Senthil,
I ran the following code
using System;
class TestApp
{
class Test
{
public int x;
}
void Foo(Test t)
{
t = new Test();
t.x = 2;
}
public void Bar()
{
Test t = new Test();
t.x = 5;
Console.WriteLine(t.x);
Foo(t);
Console.WriteLine(t.x);
}
public static void Main()
{
TestApp ta = new TestApp();
ta.Bar();
}
}
Output is
---------
With "t = new Test();" in Foo() : 5, 5
After commenting "t = new Test();" in Foo() : 5, 2
This is also as per my expectation.
How did you expect 5, 2 and 2, 2 in your example.
Please clarify
Regards
Siddhartha
|
|
|
|
|
Oops. My bad. Guess I shouldn't be typing answers late in the night. Yes, it should be 5,5 and 5,2. Well, if it is what you expected, why do you say string is treated like a value type? Only because Test is a reference type, setting t.x = 2 in Foo() changed the value (after commenting out t = new Test());
Regards
Senthil
|
|
|
|
|
Let me frame my doubt with the following code.
using System;
class Test
{
public static void Append(string strParam)
{
strParam = strParam + " - C#";
}
public static void Main()
{
string strMsg = "Hello World";
Console.WriteLine (strMsg);
Append(strMsg);
Console.WriteLine (strMsg);
}
}
Here a string strParam is being passed to Append(). Since string is a reference type, I would expect strParam to refer to the same string object to which strMsg is a reference. Hence as per my expectation on calling Append() the string " - C#" should get appended to the same string object to which strMsg is referring and it should become "Hello World - C#". But to achieve this behavior we have to make strParam as "ref".
I am unable to find justification to this behavior of string.
Thanks in advance
Siddhartha
|
|
|
|
|
What I'm trying to explain is that the behavior is how reference types work, not just string. Try doing it with your own class and you'll see it is true. In the previous example I gave, that's why when t = new Test() executed, the value of t.x did not change in the caller.
If your argument is correct, then
<br />
string x = "Hello World";<br />
string y = x;<br />
y = "Bad Boy";<br />
the last statement should change x too, I hope you agree that's not logical or intuitive. I hope you are not confusing with C++ references, which, by the way, behave as you said.
Think of references as pointers in C/C++. Take a pointer, say, int *p.
<br />
int x = 20;<br />
int *p = &x;<br />
int *z = p;<br />
int y = 70;<br />
*z = 50;
z = y;
It's the same way references operate. If you call a function passing a reference type, the *reference* gets passed by value, so if you try to change what the variable refers to, it won't affect the caller. But still because they both point to the same object, if you attempt to modify the object referred to, the caller will see the change.
Hope this helps.
Regards
Senthil
|
|
|
|