1. Computing & Technology

Document Type Definition (DTD)

What is a DTD?

From

See More About:

The document type definition (DTD) is a list of rules that function as building blocks for an XML file. The DTD code is internal when placed within the XML file and external when written as a separate document. An external DTD must link to the core XML file.

DTDs use strict syntax to describe the complete structure of a file for verification. This is the precursor to the common XML schema. A parser compares the information contained in the DTD to the format and structure of the XML code to verify that the file follows the rules. From this comparison, the processor can determine if the XML file contains valid elements and apply any significant criteria, such as instance names.

DTD declarations name element types, attribute lists and entities within the XML document. Since XML allows the designer to create all the elemental components for each file, a DTD provides a method to verify those structures. This way the parser can identify each piece, make sure it is correct and then properly display the data.

The syntax on a DTD file is much more complex than basic XML. XML was designed to simplify the process of providing data to an Internet page. The DTD complicated things, but was necessary to distinguish the XML elements. A schema follows the basic XML model and may be less complex to author.

Sample DTD

More Information About DTDs

©2012 About.com. All rights reserved.

A part of The New York Times Company.