XML Syntax & Rules

The five mandatory syntax rules for creating well-formed XML documents.

Interactive Tool: Practice in real-time with Pixlint's free browser-based XML Syntax Validator. No data is uploaded.
Open tool →

To be parsed without errors, an XML document must be well-formed, conforming strictly to the XML specification:

The 5 Core Rules

  1. Single Root Element: Every document must have exactly one root element that wraps all other tags.
  2. All Tags Must Close: Every opening tag <item> must have a matching closing tag </item> or be self-closing (<item />).
  3. Proper Nesting: Tags must nest strictly: <b><i>text</i></b> is valid; <b><i>text</b></i> is invalid.
  4. Case Sensitivity: <Title> and <title> are treated as different tags.
  5. Quoted Attributes: All attribute values must be enclosed in single or double quotes (e.g. <tag id="12">).