A document type definition (DTD) is a set of markup statements that define a document type for an SGML family markup language (SGML, XML, HTML).
(Source: Wikepedia)
That is, it informs the document what rules the user Agents should follow, and what is not allowed in a particular version of an XML. It would be a way to tell them, what are the rules that the document intends to follow and what rules the browser should use when parsing (Parsing) the document. For this reason, the
the choice of doctype
influences the type of marking you will 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 type of data #PCDATA
means it can be any text value. Now ATTLIST
provides options for a specific element. In this case, the type of locomotion of the animals is quadruped or bipedal.
This is a basic DTD that uses only a few data types. The document type definitions used for large XML databases can have thousands of lines 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 know more, in this website, which I used as a reference, is very well explained.
I found two links on the subject... Tutorials Point and Edu Tech
– MeuChapeu