I have a long local XML file like this:
<root>
<div>this</div>
<div>is</div>
<div>a</div>
...
<div>very</div>
<div>long</div>
<div>list</div>
</root>
I need to know:
- the total number of thos div elements
- the position of the element "very"
I know that I can do that by launching these two XPATH (2.0) queries:
1. count(/root/div)
2. index-of(/root/div,"very")
but the XML file is long so I hate that the XML parsing engine passes two times through all the file.
Is there a faster combination that returns for example an array with the two results, passing a single time through the file?