I have a node as follows:
Office Hours
For the XPath I use
//span
text() = is different than XPath . =(Matching text nodes is different than matching string values)
The following XPaths are not the same...
//span[text() = 'Office Hours']
Says:
Select the span elements that
have an immediate child text node equal to 'Office Hours`.
//span[. = 'Office Hours']
Says:
Select the span elements whose string value is equal to 'Office Hours`.
In short, for element nodes:
The string-value of an element node is the concatenation of the string-values of all text node descendants of the element node in document order.
The following span elements would match only #1:
Office Hours
8:00-10:00My
Office HoursThe following span elements would match only #2:
Office HoursOffice HoursThe following span element would match both #1 and #2:
Office Hours