XML
Well-Formed XML
Rules every parser enforces.
By EZ4Code Team
parserwell-formedsyntax
Code
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Well-formed XML must:
1. Have a single root element
2. Nest tags properly (close in reverse order)
3. Quote all attribute values
4. Use unique attribute names per element
5. Escape & < > as & < > -->
<rss version="2.0">
<channel>
<title>Feed</title>
<link>https://example.com</link>
<description>A valid, well-formed XML document</description>
</channel>
</rss>Explanation
An XML document is well-formed when it follows the syntactic rules: one root, properly nested tags, quoted attributes, and escaped special characters. Well-formedness is mandatory for any parser to read the document, while validity additionally checks a DTD or schema. The XML declaration is optional but recommended at the top.