As should you know by now, XML by itself only serves to deliver data. You must provide other files to format and validate the XML code. This is where the DTD and schema come into play. The advancement of technology has provided many ways to validate XML. The DTD is just one. Document Type Definitions provide rules the computer can follow when processing the code. The DTD and schema are the precursors to XSL. Although still used in some formats, learning to write these files is not a requirement to create XML platforms, but it is indispensable to know what they are and how they function. These are terms you will stumble across in your studies frequently and understanding the basic design will be an advantage.
This is an explanation of document type definitions and the role they play in XML design. DTD code comes in two forms, internal and external. This article provides a description and explanation of how DTD files work.
A document type definition explains the validation rule for elements, entities, attributes and notations. A XML processor will look at the DTD and compare the rules with the code in the corresponding XML page. Step-by-step and line-by-line, the processors validates the XML code to ensure it follows the defined rules.
DTDs define the XML code but uses a different language and syntax. This tutorial walks you through some DTD basics and provides samples on how to write a DTD. Included you will find a small XML document and the corresponding DTD code. The syntax for document type definitions is very different from core XML. It is more complicated. Review the sample code and work through the syntax.
Answering the most common question about DTD's and their relationship to creating valid XML. This article further explains the use of document type definitions using a creative analogy. If you want to bake a cake, you need a recipe.