DevGrill

XML Formatter & Validator

Check XML is well-formed, with the line of any error, then format or minify it.

Runs in your browser

0 chars
0 chars

What well-formed XML means

XML is still everywhere: SOAP and bank APIs, RSS feeds, sitemaps, Android layouts, Maven pom.xml files and office documents. A file arrives on one line, or a tag doesn't close, and nothing reads it.

Paste your XML and it's checked as you type against the rules every XML parser enforces: tags close in the right order, there's one root element, attribute values are quoted and & is escaped. A problem is shown in plain English with its line and column. When it's well-formed, you get it neatly indented, or minified onto one line.

How to use the XML Formatter & Validator

  1. Paste your XML. Or load the sample, a small order export squeezed onto one line.

  2. Fix any problem shown. The message under the box says what's wrong and where, like </c> doesn't match the open <b>.

  3. Choose Format or Minify. Format indents with 2 spaces, 4 spaces or tabs. Minify removes the spaces and line breaks between tags.

  4. Copy the result. Or compare it with another version in the Diff Checker.

Tips

  • HTML entities such as &nbsp; or &copy; aren't part of XML. Use number references like &#160; and &#169;, or declare them in a DOCTYPE.
  • Text is never changed. Where text and tags are mixed, like <p>Hello <b>you</b></p>, or an element has xml:space="preserve", it's copied exactly as written.
  • A lone & must be written &amp;, and < inside an attribute value must be &lt;.

Frequently asked questions

Does it validate against an XSD or DTD?

No. It checks that the XML is well-formed, which every parser requires. Checking against an XSD or DTD needs a schema engine that browsers don't have, and DevGrill doesn't upload your files to a server to do it.

Are comments, CDATA and the XML declaration kept?

Yes. Comments, <![CDATA[…]]> sections, processing instructions, the <?xml …?> declaration and DOCTYPE are all kept, in both Format and Minify.

Will formatting change my data?

Only the whitespace between tags changes. Text, attribute values and entities stay exactly as you wrote them, and attribute quotes are kept.

Is my XML sent anywhere?

No. Checking and formatting run in your browser.

Related tools