Why we need a DTD?
Added 26 Jul 2008
XML is a language specification. Based on this specification, individuals and organizations develop their own markup languages which they then use to communicate information with. When this information is transferred from source to destination, the destination:
* Needs to know how the document is structured and
* Needs to check if the content is indeed compliant with the structure
The Document Type Definition also known as DTD holds information about the structure of an XML document. In this chapter we will understand the important aspects of DTDs. The concept of a DTD is not new. It actually finds its origins with SGML (remember the good old SGML?!) and has of course evolved since.
Any human or computer reader can “read” the DTD and understand how the document content will be made available. As a corollary, if the document content is not present in the way that the DTD has specified, the human or computer reader can reasonably assume that the content is not properly structured and throw an error or request a resend.