I am reading about the short-cut, '//', which apparently is a shortcut for:
'/descendant-or-self'
it is clear what to expect, say, from a simple example of such an expression, eg,
//myNode
It will return a node list of all instances in the document, found from the root, of elements called 'myNode'.
However, what is the meaning of a more complicated expression, such as:
//aNode//myNode
?
Since // (being the shortcut for '/descendant-or-self') matches the root node twice, does this mean the first part of the expression '//aNode' is redundant, and only adds to the time it takes to complete the execution of the expression (after having still only found all expressions throughout the whole document, of 'myNode') ?
Are '//myNode' and '//aNode//myNode' going to result in exactly the same thing?
Finally, if I was searching through the document for an instance of node 'myNode' which was an indirect descendant of node 'interestingTree'. But I don't want the instance of node 'myNode' which is an indirect descendant of node 'nonInterestingTree', how should I do this ?
for example, searching in the document:
<root>
<anode>
<interestingTree>
<unknownTree>
<myNode/><!-- I want to find this one, not the other, where I don't know the path indicated by 'unknownTree' -->
</unknownTree>
</interestingTree>
<nonInterestingTree>
<unknownTree>
<myNode/>
</unknownTree>
</nonInterestingTree>
</anode>
<anode>
<someOtherNode/>
</anode>
</root>
Thanks!