In the XML below, we want to get the value of the second occurrence of the element c under the whole xml, which is the "Result". What xpath expression can I use to get this? Note that I do not know the index of the element 'a' in my code. If I know the index a, xpath is easy (/ root / a [4] / b / c).
However, all we know is the second appearance of element c under the entire document. The structure of the document is the same, i.e. There are two cases. One without values ββfor element a. The second element, element b and c, may fall under element a.
<root> <a></a> <a></a> <a> <b> <c>junkdata</c> </b> </a> <a> <b> <c>Result</c> </b> </a> </root>
source share