1
我有一个看起来像这样的xml文档。用xpath匹配第一组元素
<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']
,但很明显,还有更多。提前致谢。
对于例如您的意思是否与关闭标签或为那只是一个错字? –
2010-03-26 18:06:54
啊...对不起,这是一个错字。 :) – 2010-03-26 18:18:43