Data & Code

XPath Tester

Evaluate an XPath expression against XML in your browser.

Read the guide

Run the tool

The calculation runs in your browser. This tool does not send your input to JVR Software.

More information

Back to the tool

What it is and when to use it

XPath Tester evaluates an expression against a sample XML document in your browser. Use it to find particular elements, inspect an attribute, count records or refine a selector before putting it into a feed or document-processing workflow.

How it works

The page uses the browser's XPath support. An expression can return a set of nodes, text, a number or a boolean. A leading slash starts from a document path, a double slash searches descendants, and predicates in square brackets restrict which nodes match.

How to use it

  1. Paste the full sample XML.
  2. Enter an expression relevant to your question and run it.
  3. Start with a simpler path if there are no matches, then add one predicate at a time as you confirm the structure.

Worked example

With <items><item id="1">A</item><item id="2">B</item></items>, //item[@id="2"] selects the second item. count(//item) asks how many items are present and returns 2. These results are different types.

Reading the result

An empty result means that the expression evaluated without a selectable match. It differs from a syntax error reported by the XPath engine or a malformed XML error. Check the case and names of the actual XML elements.

Check for XML namespaces when a familiar element name yields no match. A namespace is part of the element’s identity even when its prefix is absent in the file. This page does not expose a custom prefix resolver. Use a namespace-aware XPath environment for complicated production queries.

Common mistakes and limits

The browser engine is not a full XPath 2.0 or 3.1 processor. Namespaced XML can require a namespace-aware evaluator, especially when the source has a default namespace. Do not assume a browser test covers the XPath engines and configuration used in other systems.