XML
HTML
Examples:
XPath 1.0 syntax
/root,//descendants at any depth,.current node,..parentnamechild element,@nameattribute,text()text node[predicate]filter —[1]position,[@id='3']attribute equals,[price>10]comparison- Axes:
ancestor::,descendant::,following-sibling::,preceding::,self:: - Functions:
count(),contains(),starts-with(),normalize-space(),string-length(),position(),last()
Common uses
- Web scraping: prototype selectors before pasting into Python lxml or Scrapy
- XSLT development: test path expressions before adding to stylesheet
- SOAP / XML response inspection
- Find specific elements in HTML for E2E test selectors