Converting a DTD into a Schema
The Legacy of Document Type Definitions
There are still many organizations using SGML. Even though XML is widely available, and the Recommendation has been around a few years, there are still valid reasons to use SGML. There are still organizations using DTDs, and there probably always will be. While DTDs might not offer all of the functionality of XML Schema, they do offer some compatibility with SGML, and the fact is that for some applications they provide enough functionality that converting from DTDs to XML Schema might not really be necessary.
Of course, there are some times when DTDs don't offer the functionality you need for your XML documents. And there are also some reasons you might want to convert an existing DTD into an XML Schema. For example, you might want to convert to an XML Schema for some of the following reasons:
To ensure compatibility with new XML products
To make use of datatypes
To create more complex constraints on the validity of documents
All of these are valid reasons for converting from a DTD to an XML Schema.
So in this chapter we will discuss the differences between DTDs and Schema. It really is important that you have a good handle on these differences: Knowing them can save you a lot of effort if, in fact, the DTD you already have really suits your needs. Additionally, if you already have a DTD that is in need of conversion, it's a good idea to know how functionality translates, but even more importantly, how you can add new functionality once you have converted the DTD into an XML Schema.