I want all nodes of an xml document that are not descendants of nodes X.
(My actual problem is a little more complex, but I'm stuck with the "are not descendants" part right now).
Definition of XPath Ancestor. The ancestor axis chooses all of the current node's ancestor elements (parent, grandparent, great-grandparents, and so on). The root node is always present on this axis (unless the current node is the root node).
XPath assertion uses XPath expression to select the target node and its values. It compares the result of an XPath expression to an expected value. XPath is an XML query language for selecting nodes from an XML. Step 1 − After clicking Add Assertion, select Assertion Category – Property Content.
If you translate "are not descendants" to "have no ancestor", you get the expression //*[not(ancestor::X)]
. This will return all nodes in a document, which are not descendants of nodes named "X".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With