XPath Tester

Live

XPath Tester tests an XPath 1.0 expression against an XML document and shows what it matches.

Runs in your browser: what you enter is processed on your device and not uploaded to MyToolDock.

What is XPath Tester?

XPath Tester tests an XPath 1.0 expression against an XML document and shows what it matches. It uses your browser's XPath 1.0 engine, so XPath 2.0 and 3.0 functions such as matches() or the if expression are not available. Prefixes are read from the xmlns declarations in the document. Only the first 500 nodes are listed.

How It Works

  1. Enter an XML document and an XPath expression in the input fields on this page.
  2. Press the button to run XPath Tester.
  3. Read the type of result and, for node sets, a numbered list with the type and value of each node in the result area, and copy or download it.

Common Uses

Good to Know

Change the expression and the result updates as you type.

In more detail

Paste your XML into the first box and type an XPath expression in the second. The result updates as you type.

A node-set result lists each node with its type, which is Element, Attribute, Text, Comment and so on. Numbers, strings and true/false results are shown as a single value.

Worked example

Results were compared with lxml on 40 random documents with attributes, nested elements, text and comments, using 14 different expressions on each. Node counts, element names and string values matched, as did the numbers, strings and true/false results. Namespace prefixes, default-namespace documents and error messages were checked by hand.

Limits

It uses the XPath 1.0 engine built into your browser, so XPath 2.0 and 3.0 functions are not available. Unprefixed names cannot match elements in a default namespace; use local-name() instead. Only the first 500 nodes are listed.

Frequently Asked Questions

Why does my XPath find nothing in a document with xmlns?

In XPath 1.0 a name without a prefix only matches elements with no namespace. Use //*[local-name()="item"] or declare a prefix with xmlns:p="..." and write //p:item.

Does it work on HTML?

It needs well-formed XML. HTML pages often are not, for example with unclosed tags, so the tool will report an error.

Is my XML uploaded?

No. It is parsed in your browser.

What does XPath Tester do?

XPath Tester tests an XPath 1.0 expression against an XML document and shows what it matches. It uses your browser's XPath 1.0 engine, so XPath 2.0 and 3.0 functions such as matches() or the if expression are not available. Prefixes are read from the xmlns declarations in the document. Only the first 500 nodes are listed.

What do I need to enter in XPath Tester?

An XML document and an XPath expression.

Is my data private in XPath Tester?

Your XML stays in your browser and is not uploaded.

Is MyToolDock XPath Tester free to use?

Yes, MyToolDock XPath Tester is 100% free with no registration, subscriptions, or limits. All features are fully unlocked.

Related Tools

.env and .properties to JSON Converter .env File Validator Ascii85 Encoder and Decoder Base32 Encoder and Decoder XML Minifier YAML to JSON

More Developer Tools guides

More in Developer Tools · Browse all tools

Developer Scratchpad

Copied to clipboard!