Run XPath expressions against XML and list matching nodes.
The XPath Tester evaluates an XPath expression against an XML document and lists what it matches. Results show each node with its type and value, or a single number, string or boolean for expressions that return one. It is useful for building and debugging selectors for scrapers, XSLT, test automation and config processing.
XPath is a query language for selecting parts of an XML document. An expression is a path through the tree, such as //book/title, with optional predicates in square brackets, such as //book[@id='2']. Paths can select elements, attributes (//book/@lang) and text nodes (//title/text()). XPath also has functions that return a plain value instead of nodes: count(//book) returns a number, string(//title) returns a string and boolean(//book) returns true or false. This tool uses the browser's built-in XPath engine, which implements XPath 1.0. That means newer XPath 2.0 and 3.x features such as sequences, regular expression functions and richer types are not available.
XPath 1.0, as implemented by the browser's document.evaluate. XPath 2.0 and later functions, such as matches() or sequences, are not available.
The prefix must be declared in the XML document itself, for example xmlns:ns="urn:x". The tool resolves prefixes using the document's own declarations, so a prefix that the document does not declare cannot be used.
In XPath 1.0 an unprefixed name matches only elements with no namespace. If the document sets a default xmlns, its elements are in that namespace, and this tool can only match them through a prefix that the document declares. A common workaround is //*[local-name()='item'].
Path expressions return a set of nodes, which are listed one per row. Functions such as count(), sum(), string() and boolean() return a single number, string or boolean.
No. The document is parsed and queried in the page and is not sent to a server.