XPath condition returning "wrong" node
When doing something like /entries/entry/key='test'
, I always get the node key returned.
But I want the entry node. How can I get it?
My XML looks like this:
<entries>
<entry>
<key>开发者_StackOverflow中文版test</key>
</entry>
</entries>
You want to select the entry node and match subelement "key"'s value to the text 'test' . This should do it:
/entries/entry[key='test']
精彩评论