A DTD performs a function analogous to that of a grammar: it formally defines what are the legal productions of a given markup language. Of course, DTDs can be as lax or as restrictive as any other kind of grammar: the designer of a DTD generally has to trade off generality of use with accuracy of error detection. The simplest kind of DTD would be one which did no more than specify a set of tag names, requiring only that every element tagged in a document use one of them. Such a DTD would of course be unable to detect errors such as <name>s occurring within <name>s or within <date>s, nor to prohibit such errors as register entries appearing other than inside registers. Creating correctly encoded texts with such a DTD would be rather like trying to speak a foreign language with the aid of a lexicon of the language, but no idea of its syntax.

(Burnard 2014,ยง 5.1)

Contributed by Wout. View changelog.