小编Mar*_*ing的帖子

XPath - 获取没有特定类型子节点的节点

XML:/A/B/A

我想得到所有A没有B孩子的节点.

我试过了

/A[not(B)]  
/A[not(exists(B))]
Run Code Online (Sandbox Code Playgroud)

没有成功

/*[local-name()="A" and .... ]如果可能的话,我更喜欢带语法的解决方案.有效的想法吗?

澄清.xml看起来像:

<WhatEver>
  <A>
    <B></B>
  </A>
</WhatEver> 
Run Code Online (Sandbox Code Playgroud)

要么

<WhatEver>
  <A></A>
</WhatEver>
Run Code Online (Sandbox Code Playgroud)

xpath

62
推荐指数
3
解决办法
5万
查看次数

标签 统计

xpath ×1