This is a cheat sheet for the DTD language. It is a follow up to the XML Cheat Sheet and summarizes this DTD Tutorial. There is also an XML Schema Cheat Sheet.
For reference this is the XML Specification (which also documents DTD) and the version annotated by Tim Gray.
<!DOCTYPE root-element [ element-declarations ]>
or externally defined e.g.
<!DOCTYPE root-element SYSTEM "filename.dtd">
where the element-declarations are in filename.dtd
<!ELEMENT note (to,from)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)>
This says that note contains 2 child elements and to and from are of type #PCDATA .
<!ELEMENT element-name category>
or
<!ELEMENT element-name (element-content)>
<!ATTLIST element-name attribute-name attribute-type default-value attribute-name2 attribute-type2 default-value2 ... >
for example:
<!ATTLIST payment currency CDATA "US Dollars" amount CDATA #REQUIRED form (Cash|Cheque) "Cheque">
<!ENTITY writer "Donald Duck.">
or external e.g.
<!ENTITY writer SYSTEM "http://a.com/entities.dtd">
<author>&writer;</author>