What Is a Well-Formed XML Document?

The W3C, which is responsible for the term well-formedness, defines it this way in the XML 1.0 recommendation (I'll take a look at each of these stipulations later):

A textual object is a well-formed XML document if:

  • Taken as a whole, it matches the production labeled document.

  • It meets all the well-formedness constraints given in this specification (that is, www.w3.org/TR/REC-xml).

  • Each of the parsed entities that is referenced directly or indirectly within the document is well-formed.

The W3C calls the individual specifications within a working draft or recommendation productions. In this case, to be well formed, a document must follow the “document” production, which means that the document itself must have ...

Get Real World XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.