我有一个看起来像这样的 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']
,但很明显还有更多。提前致谢。