XPath Tester
XPath tester online. Test XPath queries against XML and see matching nodes. Free XPath evaluator in your browser.
XML document
0 lines · 0 chars
Loading editor...
Features
- Run XPath 1.0 expressions with the browser engine
- See matching nodes, strings, numbers, or booleans
- Cap at 500 matches so a * query cannot freeze the tab
- Works on the XML you paste, not a live URL
- Copy any match
- Useful for RSS items, SOAP bodies, and config keys
Common Use Cases
- Pull all //book/title values from a catalog
- Test an XSLT select before you run a transform
- Count nodes: count(//error)
- Read an attribute: //book/@id
- Debug why a feed item selector is empty
XPath in the browser
XPath is a query language for XML trees. This page uses document.evaluate, which is XPath 1.0. You get node sets, strings, numbers, and booleans. You do not get XPath 2.0 functions or JSONPath.
Default namespaces are a common trap: an element in a namespace may not match //foo unless you use local-name(). We do not auto-bind prefixes from the document.
Examples
Valid - All titles
//book/title Valid - Attribute
//book/@id Invalid - Invalid expression
//book[Frequently Asked Questions
Why does //item match nothing?
Often a default namespace. Try //*[local-name()="item"].
Is this XPath 2.0?
No. Browsers implement 1.0. Functions like tokenize() are not here.
Do you fetch the URL in my XML?
No. Paste the document. We do not retrieve remote files.
Tips
- Start with //tagname then tighten the path.
- count(//*) is a quick way to see if the document parsed as you expect.