Start a project

Tool 60 of 100 · Data

XML Formatter & XPath Tester

Paste XML to check it, tidy it and query it with XPath, including namespaced feeds and sitemaps, then convert it to JSON if you need to.

XML Formatter & XPath Tester at a glanceIllustration: 1, XML; 2, processed in your browser; 3, Formatted + XPath.XML Formatter & XPath Tester</>1XML3Formatted + XPath2In yourbrowser
1 XML 2 processed on your device 3 Formatted + XPath

XML Formatter & XPath Tester

XML

Result

Formatted XML

XPath query

For a default namespace (like sitemaps), use the prefix d:. Other prefixes come from the document.

#Match

As JSON

XML converted to JSON

01

What it does

Checks XML is well-formed, pretty-prints or minifies it, runs XPath 1.0 queries with namespaces and converts it to JSON.

  • Well-formedness errors with line numbers
  • Pretty-print or minify
  • XPath 1.0 with namespaces (default namespace as d:)
  • Matches listed with their paths

02

Private by design

Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

03

What you get

Formatted XML, query results and JSON, with a Copy and a Download button on every result.

  • XML
  • XPath
  • Sitemaps
  • RSS

Why it matters

XML is still everywhere on the web: sitemaps, RSS and Atom feeds, SVG, SOAP APIs and office files. A single unclosed tag breaks the whole file, and minified feeds are impossible to read.

This tool checks the XML with the browser's own parser and points to the line with the problem, formats it neatly, and runs XPath queries, which is the quickest way to pull every <loc> out of a sitemap or every title out of a feed. Namespaces work too.

How it works

  1. InputAn XML document, feed or sitemap
  2. In your browserChecked by the browser's XML parser
  3. OutputFormatted XML, XPath results and JSON

Where it fits in a designer's workflow

  1. Plan
  2. Design
  3. Build
  4. Test
  5. Launch
Debugging feeds, sitemaps and SOAP responses.

By the numbers

Elements in the sample sitemap<urlset>: 1; <url>: 3; <loc>: 4; <lastmod>: 3; <priority>: 3; <image>: 1<urlset>1<url>3<loc>4<lastmod>3<priority>3<image>1
Counted with Python's XML parser from this tool's 593-byte sample. The sitemap uses a default namespace, which is why the XPath examples write //d:url/d:loc; a plain //url finds nothing. Source: XPath 1.0.
Show the numbers as a table
ElementCount
urlset1
url3
loc4
lastmod3
priority3
image1

How to use it

  1. Paste the XML.
  2. Fix any error at the line shown.
  3. Type an XPath query to pull out values.
  4. Copy the formatted XML, the matches or the JSON.

FAQ

Does it validate against a schema (XSD)?

No. It checks the XML is well-formed. Schema validation needs the XSD, and usually a server-side tool.

How do I query a namespaced document?

Elements in the default namespace use the d: prefix, for example //d:url/d:loc in a sitemap. Other prefixes work as declared.

Which XPath version?

XPath 1.0, which browsers support natively.

How are attributes shown in JSON?

With an @ prefix, and text content as #text when an element also has attributes or children.

Work with me

Want a site that gets these right?

I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

All developer tools · Back to leej.uk