Skip to content
Jellykit

XPath Tester

Run an XPath expression against an XML document and see every node it selects, with a path to each one.

  • Runs on your device
Loading tool

About XPath Tester

Paste XML or drop a file, write an XPath 1.0 expression, and the matches appear as you type: each node with its type, an exact path from the root and its text, plus the matched XML ready to copy. Expressions that return a number, a string or a true-or-false value show that value instead.

Namespaced documents work too. Prefixes the document declares can be used as they are, and elements in a default namespace are reached through a prefix you choose, because XPath 1.0 has no other way to name them.

How it works

  1. The XML is first checked for well-formedness, so a broken document is reported with the line and column of the problem rather than a vague browser error.
  2. The expression is then evaluated by the XPath 1.0 engine built into this browser, the same one web pages use, so functions such as count(), contains() and position() behave as the standard says.
  3. Node results are listed in document order. Each path uses positions, such as /order[1]/items[1]/item[2], so pasting it back selects exactly that node.

Questions

Why does //item find nothing when the document clearly has item elements?

The document probably declares a default namespace (xmlns="…"). In XPath 1.0 a name with no prefix only matches elements in no namespace. Write the name with the prefix set under the options, //d:item by default, and it will match.

Which XPath version does it support?

XPath 1.0, which is what browsers implement. XPath 2.0 and 3.1 features such as sequences, regular-expression functions and if-then-else are not available and are reported as an invalid expression.

How large a document can it handle?

Up to 2 MB of XML, typed, pasted or dropped. Queries run in this tab, so an expression that compares every node with every other can take a moment on a large document. Up to 250 matches are listed in the table and the first 50 are shown as XML; the total count is always given.

Is my XML sent anywhere?

No. The document is parsed and queried by this browser tab, and nothing is uploaded.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.