Why Use a DTD?

We've already discussed that you might want to make use of a DTD to enforce rules in an XML document. That is the generic case for using a DTD. Here are some specific instances in which you may want to use a DTD to create valid XML documents.

Using a Predefined Markup Language

Let's say you are using the Chemical Markup Language (CML) to define some molecular structures in an XML document. The CML is a markup language that has been defined to make it easy to exchange chemical data among chemists. Therefore, it's important that they all utilize the language in the same way. If authors were to apply the CML in different ways, they would not be able to ensure that everyone's CML documents were compatible or made sense. So, this is ...

Get Special Edition Using XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.