A document type definition (DTD) is a set of markup declarations that define a document type for an SGML (SGML, XML, HTML) family markup language.
(Source: Wikepedia )
That is, it tells the document what rules user agents should follow, and what is not allowed in a given version of an XML. It would be a way of telling them, what rules the document wants to follow and what rules the browser should use when parsing the document. For this reason,
Choosing doctype
influences the type of markup you're going to use.
A simple example of a DTO used to define an animal:
<!DOCTYPE animal [
<!ENTITY header "Detalhe do animal">
<!ELEMENT especie (#PCDATA)>
<!ATTLIST tipoLocomocao (quadrupede | bipede) #required>
<!ELEMENT alimentacao (#PCDATA)>
]>
In this example, the item header was first set to Detalhe do animal
. The data type #PCDATA
means that it can be any text value. Already ATTLIST
provides options for a specific element. In this case, the type of locomotion of animals is quadruped or biped.
This is a basic DTD that uses only a few data types. Document type definitions used for large XML databases can have thousands of rows and can include many other types of data. Fortunately, DTDs can be easily modified in a text editor whenever changes need to be made.
If you want to learn more, in this site , which I very well explained.