XPath Explorer

Run XPath queries against an XML document and see every match with its path. Child paths, descendants (//), attributes, indexes, predicates, text(), and count() are all supported. Everything runs in your browser, nothing is uploaded.

XML document
Matches
Matches will appear here
Ready. Press Run query.

How to use the XPath Explorer

  1. Paste XML into the document pane.
  2. Type an XPath expression, for example /catalog/book/title.
  3. Press Run query and read the matches.

Example

Query /catalog/book/title to get both book titles.

<catalog><book id="1"><title>JSON Basics</title><author>Ada</author><empty/><price>9.99</price></book><book id="2"><title>XML Guide</title></book></catalog>

Frequently asked questions

Which XPath is supported?

A practical subset: child and descendant paths, wildcards, attributes (@id), text(), comment(), node(), indexes ([1], [last()], [position()=1]), and predicates ([@id="1"], [title="x"]). count() returns the number of matches.

What does a match look like?

Each match shows its XPath and its text content, for example /catalog/book[1]/title = JSON Basics.

Can I query attributes?

Yes. /catalog/book/@id returns the id of every book, and book[@id="2"] selects only the book with that id.