XPath

XPath Tester

Paste an XML document, add namespace prefixes if it uses them, and evaluate an XPath expression. Node results are listed with their location and XML as plain text; string, number and boolean results are shown directly.

Back

1. XML & expression

XPath 1.0

Namespaces

No namespace prefixes. Add them if your XML uses namespaces.

2. Result

Shown as text
Paste XML, enter an XPath expression and press Evaluate.

DOCTYPE, entity declarations and processing instructions are blocked. Nothing in the XML is loaded or run.

About this tool

About XPath Tester

XPath Tester evaluates XPath 1.0 expressions against an XML document using the browser’s built-in engine. It shows node sets with their location and XML, and string, number and boolean results directly. Namespace prefixes can be mapped by hand or added from the document, and DOCTYPE, entity declarations and processing instructions are blocked before parsing.

XPath is used in XSLT, test automation, scraping, configuration and many XML-based formats. Testing expressions against real XML shows quickly what they select and why namespaced queries return nothing.

How to use

Step by step

  1. Paste an XML document.
  2. If it uses namespaces, add prefixes or press Add from document.
  3. Type an XPath expression.
  4. Press Evaluate and review the result type and values.
  5. Copy or download the report.
Key features

What it offers

  • Native XPath 1.0 evaluation with all standard functions
  • Node-set, string, number and boolean results
  • Editable prefix-to-namespace mapping
  • Automatic detection of namespaces declared in the document
  • DOCTYPE, entities and processing instructions blocked
  • Escaped, text-only display of matched XML
Best practices

Tips for best results

  • Map a prefix for the default namespace and use it on every step.
  • Prefer specific paths over // on large documents.
  • Use count() or boolean() to check conditions quickly.
  • Test expressions on documents with missing optional elements.
Benefits

Why people use it

Accurate

Uses the browser’s own XPath engine.

Namespace-aware

Prefixes mapped in one place.

Safe

Risky XML features are blocked.

Private

XML never leaves your browser.

FAQ

Common questions

XPath 1.0, through the browser’s built-in document.evaluate. Functions such as count(), sum(), contains(), normalize-space() and position() all work; XPath 2.0 and 3.0 features do not.
If the XML declares a default namespace (xmlns="…"), its elements are in that namespace. Map a prefix to the namespace URI — for example d → the URI — and write //d:item. The “Add from document” button does this for you.
DOCTYPEs can declare entities that expand or refer to external resources, so the tool blocks <!DOCTYPE>, <!ENTITY> and processing instructions before parsing. Remove them to test the rest of the document.
Node sets list each node’s type, a location path and its XML or text, always as escaped text — nothing is rendered or run. Strings, numbers and booleans are shown as values.
XML up to 2 MB. Up to 500 matched nodes are listed, with the total count shown, and very long node contents are shortened in the display.
XML errors show the parser’s message, usually with a line and column. Invalid expressions and unmapped namespace prefixes get a specific message.
No. Parsing and evaluation happen in your browser only.
Private by design

This runs entirely in your browser

No file or text you enter here is uploaded. Encoding and decoding happen on your device using native browser APIs — close the tab and nothing remains on a server.

Install Toolisco Add it to your device for offline, one-tap access.