The Document Type Definition

The Document Type Definition

The Document Type Definition (DTD) is a method of defining consistent structure across all XML documents within a company, an installation, and so on. In other words, it allows validation of XML documents, ensuring that standards are adhered to even for XML data where the source of the XML data is external to the company.

From an XML in databases perspective, DTD could provide a method of structural validation, which is of course very important to any kind of database structure. However, it could also be superfluous and simply get in the way. It may depend on how XML documents are created or generated as being sources of both metadata and data. If XML documents are manually created then something like DTD could be very useful. Of course, once data is created, it is possible that only one round of validation is required for at least static data.

Static data in a database is data that does not change very often, if at all. In a database containing customers and invoices, your customers are relatively static (their names don’t change—at least not very often). Transactional or dynamic data such as invoices is likely to change frequently. However, it is extremely likely that any creation of XML documents would be automatically generated by application programs. Why validate with the DTD when applications generating data (XML documents) will do that validation for you?

The DTD will be covered in a later chapter in detail, where you will deal with schemas and XML Schemas. XML Schemas are a more advanced form of the DTD. XML Schemas can be used to define what and how everything is to be created in an XML document.

Previous Section
Next Section

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows