小编Edd*_*ddy的帖子

使用 Xpath 获取属性名称(而不是属性值)

检索给定节点的所有属性名称(而不是属性值!)的 Xpath 表达式会是什么样子?xml标签?

假设有以下 XML 文档:

<bookstore>
  <book>
    <title lang="eng">Harry Potter</title>
    <price>29.99</price>
  </book>
  <book>
    <title lang="fr" type="easyreading">Monsieur Claude</title>
    <price>39.95</price>
  </book>
</bookstore>
Run Code Online (Sandbox Code Playgroud)

Xpath //title/@* 会选择“eng, fr, easyreading”,但是哪个 Xpath 会选择“lang, lang, type”?

xpath

3
推荐指数
1
解决办法
753
查看次数

标签 统计

xpath ×1