开发者

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']
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜