An Introduction to Document Type Definitions

In tutorial 3, we developed a document template for creating XML documents that can be viewed in Web browsers as HTML documents. In this tutorial, we will create a document type definition (DTD) for this template. This DTD defines a set of rules that are associated with all of the XML documents created using the template. This DTD can be used to create and validate the XML documents that conform to the rules defined in the DTD.

Many tools are available for creating and editing DTDs—for example, XML Authority, XML Spy, and Near and Far. We will use XML Authority to create and edit our DTD. You can download a trial version of XML Authority from http://www.extensibility.com. Microsoft XML Notepad cannot be used to edit DTDs (although it can validate a document that has a DTD).