Reputation: 1
I am currently going through an xml data,
<datas>
<data>
<key1>ABC</key1>
<key2>def</key2>
</data>
<data>
<key1>PQR</key1>
<key2>xyz</key2>
</data>
</datas>
Here i want to fetch the value in tag key2 from the data where the key1 is PQR
I had used the xpath expression
//datas/data[last()]/key2
but this one will work only if the last data is having the value.
what will be the xpath expression to fetch the same?
Upvotes: 0
Views: 16