Data / LOCAL TOOL

XPath Tester

Evaluate XPath 1.0 expressions against XML locally and inspect nodes, values, or paths.

Runs locally — input is never uploaded
Paste XML and test an XPath expression
XPath 1.0 expression
ResultsReady when you are
XPath results will appear here

WHAT IT DOES

Test the XPath your browser can actually evaluate.

Paste XML, enter an XPath expression, and inspect the native browser XPath 1.0 result as nodes, text values, or document paths. The evaluator parses a separate XML document, never injects it into the page, and keeps namespace mappings explicit so a prefix cannot quietly mean something different from the document you are testing.

Why use it?

Use it to test an XML selector against the actual document and inspect whether it selected nodes, a scalar value, or nothing.

How to use this tool

  1. Paste XML and enter an XPath 1.0 expression, such as //item to select unnamespaced item elements.
  2. For namespaced XML, add prefix=URI mappings and use those prefixes in the expression. An unprefixed name does not select elements merely because they use a default namespace.
  3. Test and inspect paths and values before using the expression elsewhere. XPath 2.0 and 3.1 functions are outside the browser evaluator.

Details and limitations

  • Browser-native document.evaluate is used, so the supported expression language is XPath 1.0 rather than an XPath 2.0 or 3.1 server extension.
  • Node results are shown as escaped text, values show textContent, and paths include sibling indexes when they are needed to identify a node.
  • Namespace mappings use one prefix=URI line and an unknown prefix is reported before evaluation.
  • Malformed XML and invalid XPath expressions are errors; user XML is never treated as page markup.

WORKED EXAMPLES

Select elements in a default namespace

The XML uses a default namespace, while the XPath explicitly binds that namespace to d. Keep the result mode on Nodes for this example.

XML

<items xmlns="urn:demo"><item id="a">Alpha</item><item id="b">Beta</item></items>

XPath

//d:item[@id='b']

Namespaces

d=urn:demo

Expected result

One item element containing Beta. Changing the expression to //item returns no matching element because those item elements belong to urn:demo, not the empty namespace.

COMMON QUESTIONS

XPath Tester questions

Which XPath version is supported?
The tool uses the browser's native XPath 1.0 evaluator through document.evaluate. XPath 2.0 and 3.1 functions are not available.
How do I test namespaced XML?
Enter mappings such as svg=http://www.w3.org/2000/svg, then use that prefix in the expression. A prefix without a mapping is reported instead of returning a misleading empty result.
Can XML in the result execute?
No. Results are written as text into a result panel. The XML is parsed in an inert XML document and is never appended as active HTML.