XPath Tester
NewTest XPath expressions against XML documents and see matching nodes.
Results will appear here.
Frequently Asked Questions
Can this return strings, numbers, and booleans, or only matched nodes?
It handles both. Node-set results are serialized line by line, while XPath string(), count(), and boolean-style results are shown directly as a single string, number, or boolean value.
Why does my XPath with namespace prefixes fail here?
This tool calls document.evaluate() with a null namespace resolver. That means prefixed namespace lookups are not wired up, so namespaced XPath expressions may fail or return nothing unless you work around them.
Can I test predicates and functions like //book[price > 20]?
Yes. It uses the browser XPath engine, so normal XPath expressions, predicates, and core XPath 1.0 functions work as long as the browser supports them.
What does "No nodes matched" mean?
It means the XML parsed successfully and the XPath expression ran, but the resulting node set was empty. The count stays at 0 and node types show as —.
Will it show attributes or text nodes if my XPath targets them?
Yes. Attribute nodes are shown as name="value", text and CDATA nodes are shown as their trimmed text, and the Node types summary reflects what matched.