Using XPath, you can implement a more versatile and robust data search algorithm in comparison with regular expressions. This query language allows you to significantly simplify the logic of parsers and thereby speed up their development.
Testing queries as they are composed
ZennoPoster has a built-in X\Json Path Tester with which you can test the composed expression.
You can also compose and test an XPath expression in the DevTools window: open the DevTools window, press ctrl + f to call the search bar and enter the XPath expression into it:
For example, to get the names of events on w3.org , we can use the following expression:
recursive descent (zero or more levels from the current context)
everything in the current context
links that are "grandchildren" for li
links and buttons (union of two sets of nodes)
immediate parent <p>
all next brothers
all previous brothers
all of the following elements except descendants
all previous elements except ancestors
context node and all its descendants
context node and all its ancestors
get text nodes
get the first text node
a[position() <= 3]
first 3 links
list (UL) whose first element contains the value 'OK'