Logo

XPath Tester

Evaluate XPath expressions against your XML document in real time. Supports XPath 1.0 with typed results.

XPath Tester

Evaluate XPath expressions against your XML document in real time. Supports XPath 1.0 via the browser's native document.evaluate().

Result type: Unordered Node IteratorMatches: 2
element<book id="1" category="fiction">

XML Developer's Guide Anonymous 44.95

element<book id="2" category="nonfiction">

Midnight Rain Eva Peretti 5.95

What is XPath?

XPath (XML Path Language) is a query language for selecting nodes from XML documents. Expressions like //book[@category="tech"]/title navigate the document tree the way file paths navigate a filesystem, with predicates for filtering on attributes, position, and content.

This tester evaluates XPath 1.0 expressions using the browser's native document.evaluate() engine — the same implementation your web page scripts use. Results are typed: element and attribute nodes, text, numbers, strings, or booleans.

Features

  • Evaluate XPath 1.0 expressions in real time
  • Typed results: elements, attributes, text, numbers, booleans
  • Example expressions for common query patterns
  • Clear error reporting for malformed expressions
  • Everything runs client-side — documents stay in the browser

When to use it

Use it when writing XPath for web scraping or test automation selectors, extracting data from SOAP responses, debugging queries before embedding them in XSLT or application code, or learning XPath interactively against a real document.

Frequently asked questions

Which XPath version does this tester support?

XPath 1.0, via the browser's native document.evaluate() engine — the same implementation your page scripts and most automation tools use. XPath 2.0/3.x functions like matches() or tokenize() are not available in browsers.

How do I write an XPath expression?

Start with // for a descendant search (//item finds every item element), / for direct children, [@attr="value"] for attribute filters, [1] or [last()] for position, and functions like contains() or text() for content matching. The example expressions in the tool cover the common patterns.

Does it work with XML namespaces?

Yes — namespaced elements can be matched using their prefix or local-name() (e.g. //*[local-name()="item"]), which is the practical workaround when prefixes differ between documents.

Is my XML or query sent to a server?

No — evaluation happens entirely in the browser via document.evaluate(). Nothing is uploaded, which makes it safe for internal XML payloads.

Privacy & Cookie Preferences

We use cookies to enhance your experience, analyze site performance, and support our marketing efforts. Your privacy matters, and you can withdraw consent at any time.