Consider the following XML:
<root>
<steps>
<step>1</step>
<step>2</step>
<step>3</step>
<step>4</step>
</steps>
<stepDetails step="1">Details</stepDetails>
<stepDetails step="2">Details</stepDetails>
<stepDetails step="3">Details</stepDetails>
</root>
What I need to do is find all the steps that do not have corresponding stepDetails. In the above example, only the "<step>4</step>" node would be returned.
Now, I know I can do that by querying all the steps, iterating through the collection and performing another query for each iteration. I'm hoping that there is a way of doing that with just one query. Perhaps using something like SQL's IN statement and a sub-query.
Any ideas or tips would be most appreciated.
thnx, Christoph
Use following or preceding Advanced Xpath to combine the two xpath.
XPath (XML Path Language) is a query language that can be used to query data from XML documents. In RUEI, XPath queries can be used for content scanning of XML documents. A complete specification of XPath is available at http://www.w3.org/TR/xpath .
W.R.T to your first questions, if we don't use '. ' (dot) at the beginning, then you will be basically selecting all element nodes with an @id-attribute-value equal to 'Passwd' from the entire document. By adding '//*' in XPath you would be selecting all the element nodes from the entire document.
Try this:
/root/steps/step[not(. = /root/stepDetails/@step)]
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