Reputation: 67223
I have an xml document like so:
<add-server-response>
<server id="4029" name="" notes="" state="Restoring Harddrive Image">
<login name="iDRAC" username="dracadmin" password="Ah73849SJu57S1l"/>
<ip name="system" address="199.16.205.97"/>
</server>
</add-server-response>
From this, I want to get the value of id (4029), via Xpath. What would the corresponding xpath be and is there not a tool that would let me hover over an attribute and see the xpath query?
Thanks
Upvotes: 1
Views: 319
Reputation: 24826
is there not a tool that would let me hover over an attribute and see the xpath query?
You may want have a look at:
These browser extensions, among many other useful functionalities, provide a "get XPath" like command on the selected node.
The XPath is returned as an exact (position dependent) and absolute location path.
Used directly on this web page I'm receiving:
/html/body/div[4]/div[2]/div[2]/div/table/tbody/tr/td[2]/div/div/pre/code/span[5]
But if you use it against an pure XML like your, you would receive:
/add-server-response/server/@id
Upvotes: 1