Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / July 2006

Tip: Looking for answers? Try searching our database.

XPath string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lubomir - 30 Jun 2006 20:43 GMT
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/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.