Skip to main content
PixelTools

XPath tester

Evaluate an XPath expression against XML and see every matching node. Free, private: nothing leaves your browser.

0 characters

Result

Enter an XPath expression and some XML to see the result.

Everything you need to test XPath

Live evaluation

The result updates as you type, so you can refine an expression one step at a time.

Typed results

Each result is labelled as an element, attribute, text node or comment.

Numbers, strings and booleans

Expressions such as count(//item) return their value, not just nodes.

Clear error messages

An invalid expression or malformed XML says what is wrong instead of failing silently.

100% private

Runs in your browser. Nothing you paste is uploaded or stored.

Copy the results

Copy every result, one per line, ready to paste elsewhere.

Test an XPath expression in three steps

  1. 1

    Paste your XML

    Add the XML document you want to query. A well-formedness error shows straight away.

  2. 2

    Type an XPath expression

    Enter an expression such as //book[price > 10]/title. The result updates as you type.

  3. 3

    Read and copy the result

    Matching nodes are listed with their type. Copy them, one per line, when you are done.

Built for scrapers, configs and feeds

An XPath tester shows what an expression really selects before you put it in code. Paste XML, type a query and read the matching nodes.

Writing selectors for a scraper

Check an expression returns exactly the nodes you expect before you put it in code.

Reading config and feed files

Pull a value out of a sitemap, RSS feed or SOAP response without writing a script.

Learning XPath

Change an expression a step at a time and watch the matched nodes change.

Debugging a failing query

Find out why an expression returns nothing, such as a missing namespace or a wrong axis.

Frequently asked questions

How do I test an XPath expression online?

+

Paste your XML in the XML box and type the expression in the XPath box. The tool lists every matching node straight away, with no button to press.

Which XPath version does it support?

+

XPath 1.0, the version built into every browser. Functions such as count(), contains(), text() and position() work. XPath 2.0 and 3.0 features such as for expressions or matches() do not.

Is my XML uploaded anywhere?

+

No. The expression is evaluated by your browser's own XML engine. Nothing you paste is sent to a server or stored.

What can an expression return?

+

A list of nodes (elements, attributes, text, comments), or a single number, string or true/false value, for example count(//item) or string(//title).

How do I query XML that uses namespaces?

+

Prefixes declared on the root element can be used in the expression. For other namespaces, match on the element name with local-name(), for example //*[local-name()='entry'].

Why does it say my XML is not well-formed?

+

XPath needs a valid XML document: one root element, every tag closed, attribute values quoted. The message points at the first problem the browser found.

Test your XPath now

Free, no account needed.