Test XPath 1.0 expressions against XML as you type, with node-set, number, string and boolean results and automatic namespace prefixes.
Initializing in your browser…
Test JavaScript regular expressions live, with highlighted matches, capture groups, replace preview, plain-English explanations and code for eight languages.
Format, minify or convert XML to JSON as you type, with line-and-column error checks, a tree view and XPath queries that handle namespaces.
Minify or beautify JavaScript, TypeScript, CSS, HTML, JSON, XML and SQL as you type, without touching strings or licences, and see the bytes saved.
You are writing a script that reads an Atom feed and your XPath for the authors keeps returning nothing.
Feed and expression
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<entry><title>First entry</title><dc:creator>Ada Lovelace</dc:creator></entry>
<entry><title>Second entry</title><dc:creator>Grace Hopper</dc:creator></entry>
</feed>
//entry/dc:creatorResult
//entry/dc:creator node-set, 0 nodes (entry is in the Atom namespace) //atom:entry/dc:creator node-set, 2 nodes /atom:feed/atom:entry[1]/dc:creator Ada Lovelace /atom:feed/atom:entry[2]/dc:creator Grace Hopper
The feed declares a default namespace, so its entry elements are not "entry in no namespace", which is what an unprefixed name means in XPath 1.0. The tester binds that namespace to the prefix atom, after the last part of its URI, and with atom:entry the expression finds both creators. Each result carries a path written with the same prefixes, so it can be pasted back in to select exactly that node.
Type an XPath 1.0 expression and see what it selects in your XML as you type: matching nodes with their markup and an exact path, or the number, string or true/false value the expression returns. Namespaces declared in the document are bound for you, including the default namespace.
XPath is the query language for XML. It is used in XSLT stylesheets, Selenium and Playwright locators, SOAP and RSS processing, configuration tooling and many XML libraries. Writing an expression by trial and error inside an application is slow, so this tester evaluates it instantly against a document you paste, using your browser's built-in XPath 1.0 engine, the same one web pages and many test tools rely on.
All four result types. An XPath expression does not always return elements. //book/title returns a node-set, count(//book) returns a number, string(//title[1]) returns a string, and //book[price > 15] used inside boolean() returns true or false. Many testers ask the engine for nodes only and then show nothing, or an error, for anything else. This one lets the expression decide its own type and shows the answer accordingly: a list of nodes, or the single value, with the result type named. Example expressions are grouped by the type they produce, which is a quick way to learn the difference.
Namespaces without the headache. The most common reason an XPath returns nothing is a namespace. In XPath 1.0 an unprefixed name only matches elements in no namespace, so in an Atom feed, an SVG file or a SOAP envelope with xmlns="...", the expression //entry finds nothing. The tester reads every namespace the document declares, binds the default namespace to a readable prefix (for example atom for the Atom namespace), and lists the bindings so you can write //atom:entry. You can add your own prefix bindings too, for expressions that use different prefixes from the document.
Results you can reuse. Each matching node shows its type, name, its full markup and an absolute path that selects exactly that node, written with the right namespace prefixes so it works when pasted back in. Copy puts all matched markup, or the scalar value, on your clipboard. When an expression is valid but matches nothing, the tool says so plainly and often suggests why, for example a missing namespace prefix. When the XML itself is not well formed, you get the line and column of the problem before any query runs.
Learning aid. A quick reference covers axes and abbreviations (// for any descendant, @ for attributes, .. for the parent), predicates such as [1], [last()] and [@id="x"], node tests such as text() and comment(), and namespace functions like local-name(). Everything runs in your browser, so internal documents stay private.
Work out the select expression for a template or a library call against a real sample before putting it in code.
Find out why an expression returns nothing from an RSS, Atom or SOAP document, usually a namespace, and get the prefixed version that works.
Check XPath locators for Selenium or Playwright against a saved page fragment written as well-formed XHTML.
Count elements, sum values or test for the presence of a node in a configuration or export file without writing a script.
In the example bookstore, //book[price>15]/title returns one node, the title Sapiens, because only that book costs more than 15 (19.99).
count(//book) returns the number 3 and sum(//price) returns 47.97. The result is shown as a single value with its type rather than as an empty node list.
In the namespaced Atom example, //entry finds nothing, while //atom:entry/dc:creator returns Ada Lovelace and Grace Hopper, using the atom prefix the tool binds to the default namespace.
The usual cause is a default namespace (xmlns="...") on the root element. In XPath 1.0 an unprefixed name matches only elements in no namespace. Use the prefix listed under Namespaces, for example //atom:entry, or match by local name with //*[local-name()="entry"]. Other common causes are case differences, since XML names are case-sensitive, and position predicates such as //title[2], which means the second title within each parent.
XPath 1.0, the version built into every web browser and most XML libraries. XPath 2.0 and 3.1 functions, such as matches(), lower-case() or date functions, are not available and produce an error.
//title[2] selects each title that is the second title child of its own parent. (//title)[2] collects every title in the document first and then takes the second one overall. The examples include both so you can compare.
Yes, if the HTML is well-formed XML (XHTML). Typical HTML with unclosed tags such as <br> or <img> is not well formed, and the tester reports the first such problem. Close those tags or use a browser's developer tools for unparsed HTML.
Open Namespaces, type a prefix and the namespace URI, and press Add. Your binding is used alongside the ones declared in the document, which is useful when an expression was written for another tool with its own prefixes.
No. Parsing and evaluation happen in your browser. The share link stores only the expression.
Your text is processed locally in the browser. Nothing you paste or open is transmitted or logged.