我有一個這樣的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代碼?
非常感謝