Whatever happened to DTD?

November 18th, 2010

There was a time when Document Type Definition (DTD) was all the rage. It was created as a set of declarations alongside Standard Generalized Markup Language (SGML), and helped contribute to the development of that language, Hyper Text Markup Language (HTML), and our very own Extensible Markup Language (XML). However, today DTD has been largely replaced by more modern schema languagesthe official XML Schema, RELAX NG, Schematron, ISO DSDL, and others. So what happened?It’s true that DTD has many benefits. For one, its age and inclusion in the XML 1.0 standard means that DTD declarations are supported across XML. DTD not only has less declarations than later languages, but also shorter ones, meaning it’s possible to see more language on a single screen. DTD allows for the declaration of SGML entity setsstrings associated with unique aliases or reserved words. Finally, namespaces weren’t around at the beginning of XML, so DTDs still define document types rather than namespace types. This means that all constraints are included in a single collection. Read the rest of this entry »