我有一个这样的XML:的XPath exlude节点及其后代
<Root xmlns:test1="http://www.test1.com" xmlns:test2="http://www.test2.com" Attr="root">
<test1:Child1 Attribute1="c1" Bttribute="c2" Cttribute="c3">
<child11 Attribute11="c11">Element11</child11>
</test1:Child1>
<test2:Child2 Attribute2="c2">
<child21 Attribute21="c21">
<child211 />
<child212 />
<child213 />
</child21>
<child22 Attribute22="c22">Element22</child22>
</test2:Child2>
<test2:Child3 Attribute3="c3">
<child31>Element31</child31>
</test2:Child3>
</Root>
我想编写一个XPath,这样我会得到除了child21
元素及其后代选择所有。因此,输出应该如下所示:
<Root xmlns:test1="http://www.test1.com" xmlns:test2="http://www.test2.com" Attr="root">
<test1:Child1 Attribute1="c1" Bttribute="c2" Cttribute="c3">
<child11 Attribute11="c11">Element11</child11>
</test1:Child1>
<test2:Child2 Attribute2="c2">
<child22 Attribute22="c22">Element22</child22>
</test2:Child2>
<test2:Child3 Attribute3="c3">
<child31>Element31</child31>
</test2:Child3>
</Root>
这是什么xpath代码?
非常感谢