sitekits.dev
press ⌘K to switch tools
VALIDATE & INSPECT

XPath Expression Tester

Test XPath expressions on XML documents.

local
xpath-tester

0 result(s)

§01 ABOUT THIS TOOL

Overview

XPath remains the workhorse for querying XML: config files, RSS/Atom feeds, SOAP payloads, sitemaps, and scraper selectors. This tester evaluates an expression against your XML as you type, using the same XPath 1.0 engine your browser ships with — so results match what document.evaluate will do in production code.

How to use

  1. Enter an expression in XPath expression, e.g. //book/title/text().
  2. Paste your document into the XML textarea.
  3. The match count (N result(s)) and a numbered list of matched values update live. Invalid XML or an XPath error is shown if either input is malformed.

Examples

  • //book/title/text() on the sample → A, B
  • //book[@id="2"]/title → the title of the book whose id attribute is 2
  • count(//book)2 (number result)

Notes

The document is parsed as application/xml, so it must be well-formed — unclosed tags fail with Invalid XML. Documents with default namespaces need explicit handling in XPath 1.0; a plain //title will not match namespaced elements.

FAQ
Is my XML sent to a server?
No. The document is parsed with the browser's DOMParser and the expression is evaluated with the native document.evaluate API — everything stays in your browser.
Which XPath version is supported?
Browsers implement XPath 1.0, so this tool supports XPath 1.0 syntax. XPath 2.0/3.x features such as regular expressions or sequence types are not available.
What does the result list show for each match?
For node matches it shows the node's text content (or the attribute value when the match is an attribute node). Expressions that return a string, number, or boolean — like count(//book) — show that single value.