Built and fact-checked by the DocNectar team — see our editorial standards
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.
- Enter xML.
- Enter xPath expression.
- 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.