Manage Learn to apply best practices and optimize your operations.

What's a DTD, Anyway?

Today, you have two ways to reference XML document definitions to define the markup that such documents contain: (1) by using a Document Type Definition, or DTD, and (2) by referencing some kind of XML namespace. In the future, a third method called an XML schema, or more simply, schema, will also permit you to describe the elements, attributes, and other markup that makes up an XML document. Here, I attempt to explain why there are three possible methods for this task, discuss the pros and cons of each method, and provide pointers for more information on each topic.

To begin with, let's talk about the DTD. A DTD is an import from the world of the Standard Generalized Markup Language, or SGML. In other words, you have to know something about SGML to create a DTD that you then use to describe an XML document. Sound confusing? It can be, but DTDs currently represent the best-understood and most powerful method for defining XML document markup, contents, and structure.

My favorite DTD references include: - Charles F. Goldfarb's immortal classic: The SGML Handbook (Oxford University Press, Oxford, UK, 1991. List Price: $95.00. ISBN: 0- 19-853737-9) combines the SGML specification with cogent commentary and exegesis that includes useful coverage of DTD concepts, design techniques, syntax, and semantics.

- Eve Maler and Jean El Andaloussi wrote Developing SGML DTDs from Text to Model to Markup (Prentice Hall, Upper Saddle River, NJ, 1996. List Price: $65.00. ISBN: 0-13-309881-8). Although this book is out of stock at the publisher's, it remains the single best title on the subject I know of, despite its failure to address XML issues (of course, it predates XML, so it's not the authors' fault, by any means).

- Charlie Morris's online tutorial "How to Create a Vocabulary" ( a wonderful job of bringing the concept of DTDs home for XML developers.

Ed Tittel is a principal at LANWrights, Inc.: a wholly owned subsidiary of LANwrights offers training, writing and consulting services on Internet, networking, and Web topics, plus various IT certifications (Microsoft, Sun/Java, Prosoft/CIW).

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.