Document Type Definition
Version 0.5.0 February 11, 2001
This document is possible due to the efforts of the World Wide Web Consortium (W3C.ORG) since they are the source for DTDs and much of the documentation. Were it not for the efforts and documentation of the W3C.ORG, I would not have been able to understand the structure of the DTD and explain it here.
This documentation was produced to enable its readers to learn how to read a DTD quicker. This document does not replace the depth of the W3 documents, but allows a quick understanding. The reader should refer to the W3 documentation for more in depth and current documentation. This document is organized to show examples with initial definitions of various elements of the DTD structure.
The document type definition (DTD) is the method used to define all markup languages. These languages are based on standardized general markup language (SGML) which is the mother of all markup languages. There are DTDs for each version of HTML and other languages. In fact, you can write your own DTD and define your own markup language. DTDs are used to specify a content model for each element. The content description is part of the element declaration in the DTD and specifies the order and quantity of elements that can be contained within the element being declared.
XML is a subset of SGML. The DTD for XML differs from SGML DTDs in that XML element declarations do not specify whether a beginning or ending tag are required. This is because XML requires both a beginning and ending tag.
In the DTD, declarations are used to establish markup to be used in the document and define document structure. The form of declarations is:
<!KEYWORD NAMEPARAMETER PARAMETER2 PARAMETER3... >
The NAMEPARAMETER is the first name and defines the element name. The rest of the parameters, depending on how they are listed, define the requirements for other parameters relative to the named parameter. In other words, the way the second through the last parameters are listed define whether these parameters (or elements) are optional or required when the named parameter (or element) is used in the document.