XML Well-Formedness Rules

The seven rules that every XML document must follow to be parseable. Violating any rule causes the parser to reject the entire document with no partial recovery.

Syntax

xml-fundamentals
1. Single root element
2. All tags closed
3. Proper nesting
4. Quoted attribute values
5. Unique attribute names
6. Case-sensitive names
7. Special chars escaped (& < > " ')

Example

xml-fundamentals
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <item id="1" type="A">
    <name>Widget &amp; Co.</name>
    <price>19.99</price>
  </item>
</root>