XPath Tester
Test XPath expressions against XML documents. Supports node selection, text extraction, attribute queries, and XPath functions.
About this tool
XPath (XML Path Language) is a query language for selecting nodes from XML documents. It uses a path notation analogous to filesystem paths: / selects from the root, // selects descendants at any level, . refers to the current node, and .. refers to the parent. The language is defined by the W3C and is supported natively in all browsers via the document.evaluate() API, making it available for querying HTML documents as well.
XPath expressions use axes to specify traversal direction (child, parent, ancestor, descendant, following-sibling, preceding-sibling, etc.) and predicates in square brackets to filter nodes. For example, //book[@category='fiction'] selects all book elements with a category attribute equal to 'fiction'. Functions like text(), count(), contains(), starts-with(), normalize-space(), and string-length() enable complex data extraction from XML documents.
XPath is used in XSLT transformations for converting XML documents, in Selenium and Playwright for locating HTML elements in web automation, in XML Schema validation, and in various XML processing pipelines. XPath 1.0 has universal support; XPath 2.0 and 3.1 add many features including built-in sequence types, grouping, and richer function libraries, but have limited browser and tool support. For querying HTML, CSS selectors are generally preferred; XPath remains the standard for XML data processing.