Australian Jeevitham TECHDeveloper tools

Tech / XML Formatter & Validator

XML Formatter & Validator

Paste XML to check that it is well formed, then indent it neatly or minify it. Errors show the line and column.

About XML

XML is a text format that stores data inside tags, such as <name>Anu</name>. It is still widely used for website sitemaps, RSS news feeds, office documents, bank and government data exchange, and older SOAP web services.

Well-formed or valid?

Well-formed means the XML follows the basic rules, so any program can read it. Valid means it also matches a schema (a DTD or XSD file) that says which tags are allowed and in what order. This page checks that your XML is well-formed. To check it against a schema, use a validator that has the schema file.

The most common XML errors

  • A tag that is not closed - every <tag> needs </tag>, or must close itself like <br/>.
  • Tags closed in the wrong order - <a><b></a></b> is not allowed.
  • More than one top-level element - the whole document must sit inside one root tag.
  • A bare & or < in text - write &amp; and &lt; instead.
  • Attribute values without quotes - id=5 must be id="5".
  • Upper and lower case that do not match - <Name> and </name> are different tags.

A security note for developers

When your own server reads XML from other people, turn off external entities and DTD processing in your XML parser. Otherwise a crafted file can make the server read local files - an attack called XXE. See the OWASP XXE prevention guide. This page checks your XML in your browser, and nothing is uploaded.