Given the XML structure
<Doc>
<Other />
<Q1 />
<Q2 />
</Doc>
How can I select only nodes that begin with a "Q", e.g. /Doc/Q1 and /Doc/Q2?
It seems like this can be done with starts-with
, but I have only found examples that apply starts-with
to the value of the 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.
By adding '//*' in XPath you would be selecting all the element nodes from the entire document. In case of the Gmail Password fields, .//*[@id='Passwd'] would select all the element nodes descending from the current node for which @id-attribute-value is equal to 'Passwd'.
/Doc/*[starts-with(name(), 'Q')]
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