Document Type Definition (DTD)

Definition - What does Document Type Definition (DTD) mean?

Document type definition (DTD) refers to a set of markup declarations that define a document type for Standard Generalized Markup Language (SGML) languages. DTDs define the structure of a class of documents through element and attribute-list declarations. DTD helps parsers validate documents. It is officially recommended by the World Wide Web Consortium (W3C). DTDs have now been largely superseded by XML Namespace-aware schema languages.

Techopedia explains Document Type Definition (DTD)

DTDs make two types of declarations: Internal: Forms part of the document itself and is inserted within the DOCTYPE definition near the start of the XML document. External: Points to DTD declarations contained in an external file. For security reasons, parsers and Web browsers may be prevented from reading external subsets. DTDs describe the structure of a class of documents via element and attribute-list declarations. Element declarations name the allowable set of elements within the document, and specify whether and how declared elements and runs of character data may be contained within each element. Attribute-list declarations name the allowable set of attributes for each declared element, including the type of each attribute value, or an explicit set of valid value(s). DTD markup declarations declare which element types, attribute lists, entities and notations are allowed in the structure of the corresponding class of XML documents. DTDs have certain limitations that are related to their flexibility: Differences between the DTD syntax and the XML syntax Lack of namespace awareness Lack of data typing Limited content model descriptions