DTD

DTD: Document Type Definition [L1 ]

Adjunct to XML and SGML. markup declarations that provide a grammar for a class of documents. Defines how tags can be nested, follow each other, etc. Essentially describes the contents of each valid tags as a regular expression. Beyond that it defines the attributes per tag, and their type.

Simple example:

 <!ELEMENT database (record+) >
 <!ELEMENT record (firstname,lastname,phone+)>
 <!ATTLIST record
   created NMTOKEN #IMPLIED
 >
 <!ELEMENT firstname (PCDATA)>
 <!ELEMENT lastname  (PCDATA)>
 <!ELEMENT phone     (PCDATA)>

tDom with its extension tnc can validate XML documents by a given DTD. LV 2007 Oct 09 - it isn't clear how tdom can validate xml documents by a given DTD.

As the language of DTDs differs from XML, it is considered old-fashioned, and several replacements (which follow XML syntax) have been proposed: XML Schema, ...


MAKR: There is fun project called A little XML Schema validator ...