XPath Tester

Evaluate an XPath expression against a local XML document.

Input

Processed on your device

How to use XPath Tester

Evaluate an XPath expression against a local XML document. Test node selectors, attributes and scalar expressions before using them in a parser or transformation.

  1. Paste XML and enter XPath expression.
  2. If namespaces matter, bind a query prefix, for example s=https://example.com/schema, and use that prefix in the query.
  3. Select Process input and review the result.
Example input
<?xml version="1.0"?>
<inventory><item id="104">Notebook</item><item id="105">Pencil</item></inventory>

Example use

Test a selector for item titles in a feed with a default namespace, then compare the results to the expected records.

Output and compatibility

The page uses the browser’s XPath evaluator. Newer XPath dialect functions may not be available, and selecting attributes or text can return a different result shape than selecting whole elements.

Troubleshooting

If a known element returns no matches, check namespace bindings first. A default namespace in the document usually still needs an explicit prefix in the query.

Use XML Formatter to walk through the structure before writing the selector.

Frequently asked questions

Can it return a count or boolean?

Scalar XPath results are shown as text.

How do I match a default namespace?

Bind it to a prefix in Namespace bindings, then use that prefix in the expression.

Find a tool