Toolshed

A growing library of browser tools and deep technical guides for IT professionals.

← All guides

XML Formatter + XPath Tester

Paste, drag in, or upload XML. Format, minify, or validate it (with a real line number on error), then run an XPath 1.0 expression against it and see every matching node, a count, and a preview. Uses the browser's own DOMParser and document.evaluate() — no XML library, parser, or XPath engine of any kind is shipped to your browser. Runs entirely in your browser; nothing you paste or upload is sent anywhere.

XPath

Runs against whatever is currently in the input box above (format/minify/validate first if you want to query the reformatted version). The default (unprefixed) namespace, if the document declares one, is reachable under the prefix default — XPath 1.0 has no way to match it otherwise.

Security notes

Verified directly (not assumed): DOMParser never resolves external entities or fetches external/remote DTDs — a classic XXE payload referencing file:///etc/passwd or a remote URL both resolve to nothing, and no network request is made either way. A "billion laughs"-style internal entity-expansion bomb is rejected by the browser's own XML parser (a built-in maximum entity amplification factor) as a clean validation error rather than hanging or crashing the tab. XPath result previews are capped at 200 matching nodes shown at once — the reported match count is still exact even when there are more than that.

Known limitations

A DOCTYPE's internal subset (custom entity declarations, etc.) is not reconstructed on format/minify — only the doctype name and PUBLIC/SYSTEM identifiers are preserved. Mixed content (text and elements interleaved, like a paragraph with inline <b> tags) is left exactly as found rather than reformatted, since there's no reformatting rule that couldn't risk changing its meaning.