b2KIT

XPath Query Evaluator

Evaluate XPath expressions against XML documents with node highlighting and result tree.

Tested tool guide Tested browser tools Checked August 16, 2026

What XPath Query Evaluator does, with a checked example

This tool takes an XML document and an XPath expression you supply, evaluates the expression against the document, and shows every matching node highlighted in the source plus listed in a result tree with its node type and value. Because evaluation follows XPath 1.0 semantics, comparisons like price>20 coerce text nodes to numbers automatically. The most common surprise: expressions that assume a default namespace applies without a prefix return zero matches, since XPath 1.0 has no concept of a default element namespace.

Worked example

A concrete input and expected output from the current implementation.

Input

XML:
<library>
  <book category="fiction"><title>Dune</title><price>12.99</price></book>
  <book category="reference"><title>XML Guide</title><price>39.99</price></book>
</library>

XPath: //book[price>20]/title

Expected output

1 node matched: <title>XML Guide</title>

price is compared as a number at each book element; 12.99 fails the >20 test so the Dune book is excluded, leaving only the title of the reference book, which sits at 39.99.

How the result is produced

1

Parsing and evaluation

The XML text is parsed into a document tree, then your expression is evaluated against it using an XPath 1.0 engine. Axes (child, descendant, attribute, following-sibling, etc.), predicates, and core functions (contains, position, count, string comparisons) are supported as defined in the XPath 1.0 recommendation.

2

Highlighting and result tree

Every node the expression selects is marked directly in the source XML view and also listed separately as a result tree, showing whether each match is an element, attribute, text node, or computed value (for expressions like count() or a boolean test), so you can distinguish a single text-node match from a whole element match.

Good uses

  • Checking that an XPath expression used in a scraper, XSLT stylesheet, or test suite actually selects the nodes you intend before wiring it into code
  • Debugging why an existing XPath query returns no results, by narrowing the expression step by step and watching which part of the path stops matching
  • Exploring an unfamiliar XML file's structure by querying axes and predicates interactively instead of reading the raw markup

Limits and checks

  • XPath 1.0 only: functions and features from XPath 2.0/3.0 (matches(), sequence types, for expressions) are not available, since the evaluator implements the 1.0 data model.
  • Namespaces need explicit handling: elements in a default (unprefixed) namespace will not match an unprefixed test like //title unless the expression accounts for the namespace, which is a common source of an unexpectedly empty result.
  • Numeric versus string comparison changes results: > and < coerce operands to numbers, while = on a node-set compares as strings against each node's string value, so //price='39.99' and //price=39.99 can behave differently on the same data.

Common questions

Does it support XPath 2.0 or 3.0 functions like matches() or string-join()?

No. The evaluator follows XPath 1.0, so functions introduced in later versions are not recognized and will error or return nothing. Stick to 1.0 core functions such as contains(), starts-with(), substring(), and count().

Is my XML document sent anywhere?

No. Parsing and evaluation happen in your browser; the document and expression are not uploaded to a server as part of running the query.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools