XmlDocument and Xpath

S

Saya

Hi,

I have a xml document that looks as follows:
<root>
<user domain="domainname">usernamea</user>
<user domain="domainname">usernameb</user>
<user domain="domainname">usernamec</user>
</root>

Now when loaded how to I use xpath to find the node where username
node value is eg. usernameb ?

xmlDoc.selectsinglenode(???)

Regards
Saya
 
M

Martin Honnen

Saya said:
Now when loaded how to I use xpath to find the node where username
node value is eg. usernameb ?

xmlDoc.selectsinglenode(???)

The XPath expression is
/root/user[. = 'usernameb']
so you need
xmlDoc.SelectSingleNode("/root/user[. = 'usernameb']")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

XPath 3
XmlDocument and Xpath 5
XPath and default xml namespace 1
Error in Xpath 3
XPath query on XmlNode 2
XPath question 2
XPath querry... 2
why doesn't this xpath expression work ? 2

Top