A file associated with an SGML or XML document, giving a formalized description of the tags used and the structure of the document, as well as special entities that may be present. DTDs are optional for XML documents but compulsory for SGML documents. To validate a document is to check its structure against its DTD; a document that passes this test without errors is said to be ‘valid’ or to conform to its DTD. See also schema.