The Document Type Definition

Up to this point, all of the definitions of the structure of the data in your XML files have been implicit. While the organization was clear from the structure, that was due in large part to the simplicity of your files. That's not always the case, and it's always an advantage to explicitly define the order of the data. Therefore, it's possible to create a Document Type Definition or DTD, which is a description of how the data is to be organized.

The basic syntax of a DTD is as follows:

<!DOCTYPE DOCNAME [
 list of entities
]>

DOCTYPE is a reserved word, DOCNAME is the user-supplied name of the DTD, and the entries in the list are the components of the DTD.

Listing 5.4 demonstrates the use of text constants in XML ...

Get Sams Teach Yourself XML in 24 Hours 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.