我在VB.net中使用带有以下XML的XPath:
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
<book>
<title>English-French Dictionary</title>
<price>29.95</price>
</book>
</bookstore>
根据本指南,很容易获得具有特定属性的节点列表。
// title [@lang]
选择所有具有名为lang的属性的标题元素
但是,如何获取没有特定属性的节点列表呢?(例如,上面的第三本书,没有lang
属性。)
您可以使用:
//title[not(@lang)]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句