Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering nodes w/ local-name()... please help

Status
Not open for further replies.

beefeater267

Programmer
Apr 6, 2005
79
Hi,

have the following statement:
xmlDoc.SelectSingleNode("//*[local-name() = 'item']");

Now, that selects a single node 'item'.... however, there are multiple items with attributes. How can i constrain it? I would like to select item whos name="a"

Example:
<item name="a">xxx</item>
<item name="b">yyy/item>

I couldn't figure out how to do this . Thanks
 

haven't you posted this before ?

try this:

xmlDoc.SelectSingleNode("//*[local-name() = 'item'][@name='a']");

but this is better:

xmlDoc.SelectSingleNode("//item[@name='a']");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top