To be parsed without errors, an XML document must be well-formed, conforming strictly to the XML specification:
The 5 Core Rules
- Single Root Element: Every document must have exactly one root element that wraps all other tags.
- All Tags Must Close: Every opening tag
<item>must have a matching closing tag</item>or be self-closing (<item />). - Proper Nesting: Tags must nest strictly:
<b><i>text</i></b>is valid;<b><i>text</b></i>is invalid. - Case Sensitivity:
<Title>and<title>are treated as different tags. - Quoted Attributes: All attribute values must be enclosed in single or double quotes (e.g.
<tag id="12">).