The Concept of Well-Formedness

Well-formedness sounds very stiff, and perhaps even a little mysterious. In practice, it's a very simple concept to implement; you simply have to be complete when writing your documents.

The formal definition of well-formedness, as used by the W3C, can be found in the XML 1.0 Recommendation at http://www.w3.org/TR/1998/REC-xml-19980210#sec-well-formed. It's a bit of a circular definition, saying that a well-formed document must:

  • Meet the definition of a document.

  • Conform to all well-formedness constraints mentioned in the XML Recommendation.

  • Any parsed entity referenced in the document also must be well-formed.

That helps, sort of, but still doesn't tell us what well-formed means. What comes next in this section ...

Get XHTML by Example 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.