<Root>
<SomeElement>
...
<Wanted>.....</Wanted>
<UnWanted>
<Wanted>.....</Wanted>
</UnWanted>
<Wanted>.....</Wanted>
...
</SomeElement>
</Root>
我想在任何级别选择“ Wanted
”内部的“”元素,但不选择“ ”元素的子元素。SomeElement
UnWanted
使用 XPath /Root/SomeElement//Wanted
,我无法排除UnWanted
.