本文介绍了从 XPath 中的选择中排除特定标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道这是一个简单的问题,但我无法弄清楚.考虑以下简单的 XML 文档:
I know this is a simple question, but I can't figure it out.Consider the following simple XML document:
<root>
<a></a>
<b></b>
<c></c>
<a></a>
<d></d>
<e></e>
<a></a>
<a></a>
</root>
使用 XPath 选择节点 到
的最佳方法是什么?
What's the best way to select the nodes <b>
through <e>
using XPath?
我正在寻找类似的东西
/root/*[not(a)]
(这不起作用)
推荐答案
/root/*[not(self::a)]
这篇关于从 XPath 中的选择中排除特定标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!