XPath Tester — Online XPath Evaluator
🔒 Runs in your browser — nothing is sent to a serverXPath tester for live evaluation of any XPath 1.0 expression against an XML document. Paste your XML on the left, type an XPath query in the input above and the tester evaluates it on every keystroke using the browser's native `document.evaluate` — no server, no upload. Each match comes back with its node type (element, attribute, text, comment), its tag name or attribute name, the text content, and the full document path so you know exactly which node fired. Path expressions, predicates, attribute selection, axes (`parent::`, `following-sibling::`), and built-in functions (`count`, `contains`, `text()`) all work. Everything runs 100% inside your browser; the XML and the expression never leave your device, nothing is uploaded, logged or sent to any server.
Engine: browser-native document.evaluate — XPath 1.0.
Cheatsheet — XPath 1.0 syntax
/root— absolute path from root//tag— tag at any depth@attr— attribute[1],[last()]— predicate by position[@id='x']— predicate by attributetext()— text node childnode()— any nodeparent::,..— go up one levelfollowing-sibling::— next siblingscontains(., 'x')— string functioncount(//book)— number functionname(),local-name()— element name
Why test XPath in the browser
XPath is small enough to learn in an afternoon and rich enough that even experienced practitioners benefit from a live tester. Predicates compose in subtle ways, axes have specific node-order semantics, and the function library has gotchas — `text()` selects only direct text-node children, `string(.)` returns the concatenated text of the entire subtree. A live XPath evaluator removes ambiguity: type the expression, see exactly which nodes come back, with their full path inside the document. This page does not call any server, so production XML — RSS feeds, SOAP envelopes, sitemap snapshots, scraped HTML, SVG fragments — can be pasted in without leaving your device. Use it to debug a stuck XML scraper, validate that an Ant or Maven `pom.xml` selector still works, or iterate on a Selenium locator before pasting it back into the test.
Reading the result list and the path column
Every match comes with four pieces of information. The *type* tells you whether you selected an element, attribute, text node or comment — useful when the expression accidentally lands on the wrong node kind. The *name* is the tag for elements, the attribute name (with `@` prefix) for attributes, or `text()` for text nodes. The *text content* is the concatenated string the browser would see when reading the node. The *path* is a position-aware locator — `/library/book[2]/title` — that tells you exactly which `book` produced the hit. When several nodes match, the path is the fastest way to confirm the expression returns them in the right order and from the right places, especially with axes like `following-sibling::` where the result order is structural rather than positional.
Examples
//book/titleMatches: <title>Invisible Cities</title>, <title>Ficciones</title>, <title>TAOCP</title>//book[@category='fiction']/titleMatches: <title>Invisible Cities</title>, <title>Ficciones</title>//book[price<10]/authorMatch: <author>Borges</author>count(//book[contains(@category,"tech")])1