Categories
XPath Tester
Evaluate an XPath expression against XML and see the matching elements, attributes, or values.
Overview
Evaluates an XPath expression against the XML you enter and lists the matching elements, attributes, and text nodes.
Also supports XPath expressions that return a number, string, or boolean instead of a node set, such as count(), string(), or boolean().
Evaluation uses the browser's standard DOM API (document.evaluate) and happens entirely in your browser.
Usage
- 1
Enter the target XML into the XML field.
- 2
Enter the expression to evaluate into the XPath expression field (e.g. //item[@id='1']).
- 3
Click the "Evaluate" button to see the list of matching results.
Example
Input
XPath expression: //item[@id='1']/name
Output
<name>Apple</name>
Use Cases
Verifying an XPath expression used in scraping or XML-processing code before implementing it
Building an XPath expression to extract a specific element from a SOAP API's response XML
Checking whether an XPath expression used in XSLT or an XML config file behaves as intended
FAQ
Are XML namespaces supported?
Only default namespace resolution is supported. XPath expressions using a namespace prefix (e.g. //ns:item) may not evaluate correctly.
Why is the result empty?
If no element, attribute, or value in the XML matches the XPath expression, the result will have 0 matches.
Is the XML I enter sent anywhere?
No. The evaluation happens entirely in your browser.
Notes
Invalid XML (such as missing closing tags) is treated as a syntax error.
The supported XPath version depends on the browser's DOM implementation (roughly XPath 1.0).
Related Tools
Format XML to make it easier to read.
Validate whether XML syntax is correct.
Evaluate a JSONPath expression against JSON and see the matching values and paths.