Sample XML is given below.
<mapNode>
<mapNode>...</mapNode>
<mapNode>...</mapNode>-----I am here at 2
<mapNode>...</mapNode>
<mapNode>...</mapNode>
</mapNode>
<mapNode>
<mapNode>...</mapNode>
<mapNode>...</mapNode>
</mapNode>
I want to know whether position 3 exist or not.
Please help me.
Thanks in advance.
If you want to test if an element has a sibling following it, you can use the sensibly named “following-sibling” xpath expression:
Note that this will test if there is any following-sibling. If you only wanted to test for mapNode elements, you could do this
However, this would also be true also in the following case, because following-sibling will look at all following siblings:
If you therefore want to check the most immediately following sibling was a mapNode element, you would do this: