Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Document & Text
  3. XPath Tester
Add to favorites

XPath Tester

Test XPath 1.0 against XML with all four result types, not just node-sets, and the namespaces your document declares bound for you including the default one

Text processed locallyMore document & textJump to full guide

Related reading

  • XML and XPath: Understanding Structured Data and Powerful Queries12 min read

Initializing in your browser…

You might also like

Regex Tester & Debugger

Test regex patterns with real offsets, every capture group with its own position, all eight flags including v and y, an explanation that reads the pattern rather than guessing, and a runaway pattern stopped instead of freezing the page

XML Formatter & Tools

Format and validate XML without changing the document: CDATA, xml:space="preserve" and mixed content all survive, with errors carrying a line, a caret and a next step, plus XPath queries, a tree view and JSON conversion that names what JSON cannot carry

Code Minifier & Beautifier

Minify or beautify JavaScript, TypeScript, CSS, HTML, JSON, XML and SQL with a real lexer per language, so a comment inside a string is not deleted and a line break the code depends on is kept, with the byte saving measured

XPath Tester: a worked example

You want to know whether a document has more than two books, which is a boolean question rather than a list of nodes.

Expression

count(//book) > 2
What XPath Tester produces

Result

boolean: true

The result type is whatever the expression produces, not whatever the page asked for. An expression like this one used to come back as the number 1, because a number was requested and the engine coerced the boolean; string and boolean expressions failed outright. All four XPath 1.0 types work now, and the page names which one came back.

Evaluate XPath Expressions Against XML

Paste an XML document, type an XPath expression, and see the answer as you type. All four XPath 1.0 result types are supported, not just node-sets, and the namespaces your document declares are bound for you, including the default one, which cannot be used in an expression without a prefix.

How it works

XPath 1.0 section 1 says an expression evaluates to one of exactly four things: a node-set, a boolean, a number or a string. Your browser has a real XPath 1.0 engine, and it is what this page uses, so the answers are correct by construction. What a tester has to get right is ASKING: the browser API takes the result type you WANT as an argument and refuses the expression if it produces something else.

This page asks for whatever the expression produces and reports which of the four came back. So `count(//book)` gives a number, `string(//title)` gives a string, `count(//book) > 2` gives a boolean, and `//book` gives a node-set, and the type is named on screen beside the count.

Namespaces are the other half. The browser API takes a namespace resolver, and without one a prefixed name in an expression cannot be resolved at all. Worse, an unprefixed name in XPath 1.0 means "in no namespace", so `//title` selects nothing in an Atom feed, which is a document full of title elements. Every namespace the document declares is read out of it and bound here, and a default namespace is given a usable prefix so it can be written; you can add a binding of your own too. When an expression is valid and selects nothing, the page says whether a namespace is the reason.

Every node in a result carries an XPath that selects exactly that node, built by numbering each step among its same-named siblings, so you can copy one and use it directly. Attributes, text nodes, comments, CDATA sections and processing instructions are all shown with the kind of node they are.

A document that is not well formed gets a line, a column, the offending line with a caret under it, and a next step, from the same checker the XML formatter uses, which agrees with the browser on every document in that tool's corpus. An expression that does not compile is reported with the browser's own message plus a next step where the shape of the expression makes one obvious: unbalanced brackets, an unclosed string, or a prefix nothing binds.

How to use

  1. 1Paste your XML, or load one of the two samples
  2. 2Type an XPath expression; the result updates as you type
  3. 3Read the badge beside Result: it names which of the four XPath types your expression produced
  4. 4If a namespaced document gives nothing, read the note under the result and use the prefix it suggests
  5. 5Copy a node path from any result to select that node directly

Key features

  • All four XPath 1.0 result types: node-set, boolean, number and string, with the type named on screen
  • The namespaces the document declares are bound for you, with the default one given a usable prefix
  • Add your own prefix and namespace URI
  • An empty result explains itself when a namespace is the reason
  • Every result node carries an XPath that selects exactly it
  • Attributes, text nodes, comments, CDATA and processing instructions all shown with their node kind
  • A malformed document gets a line, a column and a caret; a malformed expression gets a next step
  • Runs entirely in your browser, on its own XPath 1.0 engine

When to reach for this

  • XSLT template development

    Test the expressions an XSLT template will use, including the boolean and string ones a node-set-only tester cannot evaluate.

  • Working with a namespaced feed

    Atom, RSS with Dublin Core, SOAP, SVG and OOXML are all namespaced, and an unprefixed expression finds nothing in any of them. The bindings are ready and the page explains the failure.

  • Web scraping preparation

    Build and check selectors before putting them in a scraper, and copy the exact path of a node you found by eye.

  • Checking configuration and build files

    Query a Maven POM, an Ant build or an Android manifest, and count or sum values as well as select them.

Frequently asked questions

Why did my expression fail before with "the result is not a node set"?

Because the tool asked the browser for a node-set whatever the expression was, and only made an exception for expressions beginning with count( or sum(. Every string and boolean expression failed. It now asks for whatever the expression produces, and this project's tests score it against xmllint on 36 expressions covering all four types: 36 of 36, where the previous version managed 16.

Why does my expression find nothing in a namespaced document?

Because in XPath 1.0 an unprefixed name means "in no namespace", and every element in a document with a default namespace is in one. The page binds the default namespace to a prefix for you and tells you to write it. Alternatively, local-name() ignores namespaces entirely.

Which XPath version is this?

XPath 1.0, which is what browsers implement. XPath 2.0 and 3.1 add sequences, a richer type system and many more functions, and no browser has them.

What is the path shown beside each result node?

An XPath that selects exactly that one node, with each step numbered among its same-named siblings. Paste it back in and you get that node and nothing else, which this project's tests check for every node of every result in the corpus.

Is my document sent anywhere?

No. It is parsed and queried in your browser.

Related tools and how they differ

  • XML Formatter & Tools: Pretty-prints or minifies XML, validates it, converts to JSON, and shows a collapsible tree. Use it to clean up a document, not to build queries.
  • Regex Tester & Debugger: The same idea for regular expressions, with two engines agreeing before an answer is shown.
  • Code Syntax Highlighter: Colours XML from a real markup lexer, so a greater-than sign inside an attribute is not a tag boundary.

Further reading

  • XML and XPath: Understanding Structured Data and Powerful Queries12 min read

Private by design

Your text is processed locally in the browser. Nothing you paste or open is transmitted or logged.