XPath Online Tester
The built-in engine supports XPath 1.0 only; namespaced documents may need prefix registration.
Enter content, then press Query
Enter content, then press Query
How to Use
📖 Overview
Config files, RSS feeds, SOAP envelopes and SVG graphics are each modest in structure, but pulling out the nodes that match a condition means writing traversal code that deals with namespaces, attributes and text nodes separately, which adds up quickly. XPath describes what you want in one line: by hierarchy, by attribute, by position, or straight to the text content and attribute values. This tool takes XML on the left and an expression on the right, evaluates it with the XPath engine built into the browser, and lists every matched node with its type, name, value and full path. When you are unsure about an expression, the hit count tells you immediately whether it is right, which is far quicker than stepping through a loop in a debugger. Parsing and evaluation happen locally, and the engine is the one your browser already ships, so no extra code is downloaded and no document is sent anywhere. The two slashes that begin most expressions matter more than they look: a single slash means an absolute path from the document root, while a double slash searches at any depth, which is usually what you want in a document whose top levels you have not memorised. Adding text() or an at sign to the end switches the result from whole elements to their text content or to attributes, and that choice changes what you can then read off each match.
✨ Features
- Evaluated by the browser native XPath engine, so the full XPath 1.0 grammar is available
- Results distinguish elements, attributes, text nodes and other node types, each labelled
- Every match carries its full hierarchical path, including a positional index where siblings share a name
- When an expression returns a number, string or boolean it is shown separately as a scalar value
- Common expressions sit on quick buttons that fill the input in one click
- A malformed document produces a clear message instead of being matched against anyway
🚀 How to use
- Paste your XML into the input box, or load the sample to try it on the bundled data
- Type an XPath expression, or click any of the quick buttons underneath
- Press Query to see what matched
- Check the hit count on the right: a zero means either the path is written wrong or the document does not contain it
- Copy the result in one click; what lands on the clipboard is the value of each match
⚠️ Notes
- XPath 1.0 only: the built-in engine has no support for 2.0 sequences or higher-order functions, so a complex expression is reported as unevaluable rather than silently mis-read
- The XML must be well formed: unclosed tags or unquoted attributes fail to parse, so complete any HTML fragment before pasting it
- Namespaces need registering: in a namespaced document a bare local name may match nothing. That is an engine limitation, not a mistake in your expression
- At most 300 rows are rendered: beyond that only the first 300 are taken, so the page never locks up
- Empty input gives no result: if either the document or the expression is blank you are prompted to fill it in, and editing either one after a run clears the result until you press Query again