When is XML document well-formed?

The most current version as of .

Example of a well-formed XML document
<?xml version="1.0"?>

XML is well-formed when it meets the following conditions:

The XML document has …

  1. … a XML declaration (<?xml version="1.0"?>)

  2. … at least one data element (<star>…</star>, <planet>…</planet>, …)

  3. … a only one root element (<solar-system>…</solar-system>)

A well formed XML document is not necessarily valid.
— David Wolf