【发布时间】:2010-03-26 18:05:30
【问题描述】:
我有一个看起来像这样的 xml 文档。
<foo>
<bar type="artist"/> Bob Marley </bar>
<bar type="artist"/> Peter Tosh </bar>
<bar type="artist"/> Marlon Wayans </bar>
</foo>
<foo>
<bar type="artist"/> Bob Marley </bar>
<bar type="artist"/> Peter Tosh </bar>
<bar type="artist"/> Marlon Wayans </bar>
</foo>
<foo>
<bar type="artist"/> Bob Marley </bar>
<bar type="artist"/> Peter Tosh </bar>
<bar type="artist"/> Marlon Wayans </bar>
</foo>
我想构造一个只返回第一个集合的 xpath:
<bar type="artist"/> Bob Marley </a>
<bar type="artist"/> Peter Tosh </a>
<bar type="artist"/> Marlon Wayans </a>
如何解决这个问题?我试过//bar[@type='artist'],但很明显还有更多。提前致谢。
【问题讨论】:
-
例如,您的意思是用 关闭
标签还是只是一个错字?