Other Characteristics of Well-Formedness

This section covers the well-formedness constraints as they apply to areas other than elements and attributes. Several of the well-formedness rules will make more sense after you have read Chapters 4 and 5.


To be well formed, XML comments must not end with the character sequence --->. A legal XML comment ends with -->— that is, two dashes and a greater than character.

Entities Must Be Declared

If a reference to an entity is present in an XML document and any of the following are true, any entity referenced must be declared:

  • There is no Document Type Definition (DTD).

  • A document has only an internal DTD subset with no parameter entity references.

  • The value of the standalone attribute in the XML ...

Get Sams Teach Yourself XML in 10 Minutes now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.