Skip to content
CALZYRA— TOOLS THAT EMPOWER —
FinanceInvestmentsHealthMathBlog
CALZYRA— TOOLS THAT EMPOWER —

Practical calculators and online tools, made to be simple and useful.

Popular Categories

  • Finance
  • Health & Fitness
  • Mathematics
  • Physics
  • Construction
  • Conversion

Finance Tools

  • Loan Calculators
  • Investment Calculators
  • Compound Interest
  • SIP Calculator
  • ROI Calculator
  • CAGR Calculator

Top Calculators

  • Mortgage Calculator
  • BMI Calculator
  • Percentage Calculator
  • Calorie Calculator
  • Tip Calculator

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 Calzyra. All rights reserved.

Free tools for everyday calculations, learning, and practical work.
HomeDeveloper ToolsXML & HTMLXML XPath Tester
Developer ToolXML & HTML

XML XPath Tester Online

Test XPath expressions against your XML documents online. Evaluate real XPath queries and inspect the matching elements, attributes and text nodes instantly.

Updated 2026-10-214 min readCalzyra Developer Tools Team
XML XPath Tester
Try:
xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <book id="1" available="true">
    <title>XML in Practice</title>
    <author>Maya Chen</author>
    <price>29.99</price>
  </book>
  <book id="2" available="false">
    <title>Learning XML</title>
    <author>Erik T. Ray</author>
    <price>39.95</price>
  </book>
  <book id="3" available="true">
    <title>XPath Essentials</title>
    <author>Sam Rivera</author>
    <price>24.50</price>
  </book>
</catalog>
18 lines463 chars34 wordsxml
XPath Results

Results will appear here

Enter XML and an XPath expression, then press Evaluate XPath

Ctrl+Enter RunCtrl+L ClearEsc Exit fullscreen

Quick Examples

Load sample data to get started

Supported Features

What this tool can do

🧭

Real XPath 1.0 Evaluation

A hand-written engine parses and evaluates the expression - never pattern matching

📦

Elements, Attributes & Text

Match elements, @attributes, text() nodes and comments, each shown as its own kind

🎯

Predicates & Comparisons

[@id='1'], [price>10], [2], [last()] with = != < <= > >= and and / or

🧮

Common Functions

count, string, sum, contains, starts-with, position, last, not, substring and more

🪜

Ten Axes

child, descendant, parent, ancestor, self, attribute, sibling axes and the // shortcut

🧭

Separate Error Reporting

XML parse errors and expression errors are reported apart, each with its position

⚡

Evaluates As You Type

The results refresh while you edit, and Evaluate XPath or Ctrl+Enter forces a run

📋

Copy Results

One click puts every match and its location path on your clipboard

How It Works

Methodology and approach

XPath 1.0 expression evaluation

The tester parses the document with a real XML parser and evaluates the expression with a hand-written XPath 1.0 engine: location paths, the child, descendant, parent, ancestor, attribute, self and sibling axes, name tests, text() and node() node tests, predicates with comparisons and and / or, and the common functions such as count, contains, position and last are evaluated for real. XML errors and expression errors are reported separately, each with its position.

What is an XML XPath Tester?

XPath is a query language for XML: an expression names the parts of a document you want - elements, attributes or text - and the engine returns every node the expression selects. //book finds every book element anywhere in the document, //book/title narrows that to the title inside each one, and a predicate such as //book[@id='1'] keeps only the books whose id attribute has that value.

An XPath tester runs those expressions against a real document before you put them into an application, a style sheet or a data pipeline. Calzyra's tester parses the XML with a real XML parser and evaluates the expression with a hand-written XPath 1.0 engine: nothing is approximated with pattern matching, and the matches you see are the nodes the expression actually selected.

How to test XPath expressions online

Paste your XML into the panel on the left - a sample document is already loaded so the workspace demonstrates the workflow immediately. Type the expression into the XPath Expression field above the editors; the results refresh automatically as you type, and the Evaluate XPath button (or Ctrl+Enter, or Enter inside the field) runs it on demand.

Each match is listed with its kind - element, attribute, text or comment - the location path that leads to it, and its serialized form. A scalar expression such as count(//book) returns the value rather than a node-set, and the number of matches is reported above the list. Everything runs in your browser; nothing is uploaded.

Errors are kept apart on purpose. A document that does not parse reports the parser's error with its line and column; an expression the engine cannot parse reports the column where it stopped; a valid expression that selected nothing says so explicitly. The previous matches are cleared the moment a run fails, so a stale result is never left next to an expression it does not belong to.

Common XPath examples

These four expressions are the everyday vocabulary of XPath. With the sample document the tool opens with: //book selects the three book elements, //book/title selects their three title elements, //book[@id='1'] selects the single book whose id attribute equals 1, and //book/title/text() selects the three text nodes inside the titles - the text itself rather than the element around it.

A numeric predicate is a position test: //book[2] is the second book, and [last()] is the final one. Comparisons such as //book[price>25] filter on a child's value, and functions such as contains(), starts-with(), not() and count() compose inside predicates or wrap the whole expression. The results below were produced by the same engine the tool runs.

XML input
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <book id="1" available="true">
    <title>XML in Practice</title>
    <author>Maya Chen</author>
    <price>29.99</price>
  </book>
  <book id="2" available="false">
    <title>Learning XML</title>
    <author>Erik T. Ray</author>
    <price>39.95</price>
  </book>
  <book id="3" available="true">
    <title>XPath Essentials</title>
    <author>Sam Rivera</author>
    <price>24.50</price>
  </book>
</catalog>
XPath //book[@id='1']
//book[@id='1']
1 match

1. <book id="1" available="true">
    <title>XML in Practice</title>
    <author>Maya Chen</author>
    <price>29.99</price>
  </book>  /catalog/book[1]

Why use an XPath tester?

An XPath expression that is almost right usually fails silently in production: it selects nothing, or it selects the wrong branch of a nearly-symmetric document. Testing it against the real document first shows exactly which nodes it reaches, through which paths, so the mistake is visible in seconds rather than in a log file later.

The tester also doubles as an inspection tool. An expression such as //@sku lists every attribute with that name wherever it appears, and //book/title/text() pulls the values out of a repeating structure without writing any code - useful when you are exploring an unfamiliar XML export, checking an API response, or preparing a query for a larger pipeline.

Related tools

  • Need to check first that the document is well-formed before querying it?XML Validator
  • Need to re-indent the XML so the nodes your expression targets are easier to spot?XML Formatter
  • Would an interactive hierarchy of the document help you find the right path?XML Tree Viewer
  • Need to extract the matched data as JSON instead of reading it here?XML to JSON Converter
  • Is the document JSON rather than XML? Query it with the JSON syntax instead.JSONPath Tester

Frequently Asked Questions

Common questions about this tool

XML & HTML Tools

XML FormatterXML ValidatorXML MinifierXML to JSON ConverterXML to CSV ConverterHTML FormatterHTML MinifierHTML ValidatorHTML to Markdown ConverterHTML Entity EncoderHTML Entity DecoderHTML to Text ConverterXML Tree ViewerXML XPath TesterHTML Meta Tag Generator

Related Tools

XML Formatter

Format and prettify XML documents

XML Validator

Validate XML syntax and structure

XML Minifier

Minify XML by removing whitespace

XML to JSON Converter

Convert XML to JSON format

HTML to Markdown Converter

Convert HTML to clean Markdown format

Quick Links

All Developer ToolsXML & HTML Category