XPath tester

Paste XML, type an expression, and see what it matches — instantly, in your browser. XML Foundry evaluates XPath 1.0 and XPath 3.1 with a conformant engine, highlights every matched node in the document, and explains errors in plain English. Nothing is uploaded: your XML never leaves the tab.

Example

XPath on the Recipes sample:

//recipe[@difficulty = 'easy']/name

Returns the name of every recipe whose difficulty attribute is 'easy'.

Open it in the Sandbox

What you can do

The Sandbox is a full workbench rather than a single input box, so you can work the way you would in a real editor.

  • Switch between XPath 1.0 and XPath 3.1 to see exactly where the versions disagree.
  • Load one of 100+ built-in XML samples, paste your own document, or edit XML in place.
  • See matched nodes highlighted directly in the document, alongside a result table.
  • Declare namespace prefixes, or let auto-detect map them from the document.
  • Click any node to generate its absolute path with Pick mode.
  • Ask for a plain-English explanation of an expression, or why one returns nothing.

Which XPath version should I test against?

XPath 1.0 is what browsers, Selenium, and most XML tooling implement. XPath 3.1 adds sequences, let bindings, arrow operators, maps, arrays, and a much larger function library. If your expression has to run inside a browser or a Selenium locator, test it as 1.0. If it runs inside a modern XSLT or XQuery processor, use 3.1.

The version toggle re-evaluates immediately, which makes it a fast way to find out whether a failing expression is a syntax problem or a version problem.

Why an expression returns nothing

Almost every empty result comes down to one of three things: the document has a default namespace and the expression doesn't account for it, the path starts from the wrong context node, or a predicate compares a node against a string that includes surrounding whitespace.

The Sandbox flags all three. Namespace-aware documents get a prefix panel, the axes explorer shows what is actually reachable from a chosen node, and normalize-space() is one click away in the reference.

Keep going