Skip to content
D DocNectar

Free XPath Evaluator for XML

Run an XPath 1.0 expression against pasted XML and see the matching nodes.

100% Free No Signup Works on all devices

Built and fact-checked by the DocNectar team — see our editorial standards

Thanks for rating!

Key Features

Instant Calculation

Get accurate results in real time with our optimized algorithm.

Mobile Friendly

Fully responsive design. Works on all devices & screen sizes.

Privacy Focused

Your data stays on your device. We don't store any inputs.

100% Free

No hidden costs. This tool is completely free forever.

XPath is the standard query language for selecting nodes and values out of an XML document. This tool lets you paste XML and an XPath expression and see exactly what it matches — useful for testing an expression before wiring it into real code.

How it works

The XML is parsed with PHP's DOMDocument, then queried using DOMXPath (XPath 1.0). Matches are returned as either a set of nodes (their text content) or a scalar value (string, number, or boolean), depending on what the expression itself returns.

  1. Enter xML.
  2. Enter xPath expression.
  3. Click Calculate to see your results.

Examples

Selecting all book titles

Given a <catalog> of <book> elements, the expression //book/title/text() returns the text content of every title element anywhere in the document.

Who should use it

  • Testing an XPath expression before using it in a scraper, importer, or config parser.
  • Exploring the structure of an unfamiliar XML document.

Industry applications

  • Web scraping and data extraction
  • XML-based API integration and testing

Advantages

  • Instant feedback on node-set, string, number, or boolean results.
  • Uses the same DOMXPath engine PHP applications rely on.

Limitations

  • Limited to XPath 1.0 — no support for XPath 2.0/3.0-only functions or syntax.

Common mistakes to avoid

  • Forgetting that XML with a default namespace requires namespace-aware XPath (a plain //element often silently matches nothing).
  • Using XPath 2.0-only syntax that DOMXPath (XPath 1.0) doesn't recognize.

Best practices

  • Start with a broad expression (like //* or //tagname) to explore an unfamiliar document's structure before narrowing down.
  • Test the exact expression here before pasting it into application code, so failures are isolated to the expression itself.

Tips

  • Run the XML Validator first if you're unsure whether malformed XML is why your expression isn't matching.

Frequently asked questions

Yes, with no signup and no limit on how many expressions you test.
No — PHP's DOMXPath implements XPath 1.0 only, so functions or syntax specific to later XPath versions (like for-loops or sequence types) aren't supported.
Common causes: a namespace on the elements that the plain expression doesn't account for, a typo in an element/attribute name, or an incorrect assumption about the document's structure — try a broader expression like //* first to explore the tree.
A node-set result (like //book) returns zero or more matching elements; a scalar result (like count(//book) or //book[1]/@id = "1") returns a single number, string, or boolean value instead.

Get new calculators and guides in your inbox

No spam — just new tools like XPath Evaluator for XML and practical guides.

Favorites