<bookstore>
<book category="COOKING">
<div lang="en">Everyday Italian</div>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price dollarValue="1.5">30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price dollarValue="1.5">29.99</price>
</book>
<book category="WEB">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price dollarValue="1.5">49.99</price>
</book>
<book category="WEB">
<p lang="en">Learning XML</p>
<author>Erik T. Ray</author>
<year>2003</year>
<price dollarValue="1.5">39.95</price>
</book>
</bookstore>
在上面的XML数据中
我想获得text()节点,其属性为 lang="en"
所以这意味着匹配
<div lang="en">data</div>
<title lang="en">data</title>
<p lang="en">data</p>
节点不限于title,div,p
可能会有更多。所以我不能分开查询这些
我怎样才能做到这一点?
您可以*
用来引用任何名称的元素节点,例如:
//*[@lang='en']/text()
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句