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

XPath Syntax to Select Attribute Value

Status
Not open for further replies.

HisMightiness

Programmer
Mar 17, 2004
54
US
I am still quite a novice with XPath, so I need some help understanding something. Let's assume that we have the following XML:
Code:
<rootItem>
    <element1>Some Value</element1>
    <element2 attribute1="foundme!">Another value</element2>
</rootItem>
Using XPath, would I be able to get the value of "attribute1" with the following query?
Code:
//rootItem/element2/@attribute1

Will
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top