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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XPath expression to search entire document for attribute X

Status
Not open for further replies.

titanandrews

Programmer
Joined
Feb 27, 2003
Messages
130
Location
US
Hi All,
Is it possible to create an XPath expression that can return ALL nodes within a document that has an attribute X with a value of Y?


thanks,

Barry
 
Yes, your xpath would be //@{attribute name}
Code:
<?xml version="1.0" encoding="UTF-8"?>
<root>
   <a name="1"/>
   <b>
      <c name="2"/>
   </b>
</root>
Running an xpath of "//@name" returns nodes a and c

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top