Item 34. Read the Complete DTD

One of the innovations of XML was making validity optional. Many XML documents do not have DTDs at all. Even if a document has a DTD, there is no guarantee that the document is valid with respect to its DTD. Invalid, merely well-formed documents can be usefully processed. In fact, even if the document has a DTD the processor may choose to ignore it, and that's where a potential problem arises, because DTDs do more than merely determine whether or not a document is valid. They also make contributions to the document's information set (infoset) in several ways.

  • They define entity references such as © and &signature;.

  • They provide default values for attributes.

  • They declare notations.

  • They declare unparsed entities. ...

Get Effective XML: 50 Specific Ways to Improve Your XML now with O’Reilly online learning.

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