A document model defines the vocabulary and grammar rules for a particular markup language. Here are some examples of what you can achieve by using a DTD model:
There are two kinds of DTD declarations: internal or external. One can combine them though.
The syntax for the internal subset of DTD is:
Here root is the name of the document's root element and declarations are the statements that comprise the DTD.
In an external declaration the declarations are placed in an external file that is accessed from the XML document. They can be of two types: system and public. The system identifier allows you to specify the location of an external subset.
The uri (Universal Resource Identifier) can be a system file or a document on another server.
A public identifier is added to provide the public name of the DTD:
Here the id is a name of a public identifier and the uri is a location of the DTD in case the XML parser cannot process the public identifier. Many browsers including the Internet Explorer and Firefox have built in XML processors that are aware of several public DTDs.
This is a standard XHTML DTD with id = "-//W3C//DTD XHTML 1.0 Transitional//EN". If this DTD is not built into a specific browser, it still can be accessed at the provided location.
Both system and public DTDs can be extended by internal ones. In the later case, the internal declarations have a preference in processing and can override the corresponding external declarations. The syntax is:
or, respectively,