Need to know the differences between and in XPath?
Hello Emma,
The expressions your talking about, select different nodesets:-
.//*[@id='Passwd']
The ‘.’ at the start indicates that the processing will start from the current node.
The ‘*’ is used for selecting all the element nodes descending from the current node with @id-attribute-value equal to ‘Passwd’.
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.