The core rules that make XML well-formed. For how XML compares to JSON, see What Is XML?.
| Rule | Detail |
|---|---|
| One root element | Every XML document must have exactly one top-level element containing everything else |
| Tags must be closed | Every opening tag needs a matching closing tag, or a self-closing tag like <br/> |
| Proper nesting | Tags must close in the reverse order they opened |
| Case-sensitive tags | <Item> and <item> are treated as different tags |
| Quoted attribute values | Attribute values must be wrapped in quotes, like id=”42″ |
The XML Formatter & Validator formats and validates XML instantly.
XML Formatter & Validator
A declaration like is recommended and often expected, though not every parser strictly requires it.
No. A well-formed XML document must have exactly one root element that contains all the other elements.
Find the right tool, or browse Brekzy's other resources.