Hi,
I want to get the node with text=”{123}”.
1/
The following statement works fine:
XmlNode wksNode = parentNode.SelectSingleNode("child::wks[text()='{123}']");
2/
When I try to use a variable for the value of text, it doesn’t work anymore:
string str = "child::wks[text()='" + myText + "']";
XmlNode wksNode3 = parentNode.SelectSingleNode(str);
What is wrong? The variable str is exactly the same like the string used
within the function SelectSingleNode in case 1/
Thanks for help,
Lubomir
Martin Honnen - 01 Jul 2006 12:26 GMT
> When I try to use a variable for the value of text, it doesn’t work anymore:
> string str = "child::wks[text()='" + myText + "']";
> XmlNode wksNode3 = parentNode.SelectSingleNode(str);
Do you get a runtime error? Which one exactly for which line?
Or what "doesn't work anymore" mean? Is wksNode3 null?
Then show us how str looks exactly in this case. And the OuterXml of
parentNode as well.

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/