Document type definitions (DTDs) define legal building blocks for XML documents. It uses a series of legal elements to define the structure of the document.

A DTD can be declared in an XML document as a line or as an external reference.

DTD - attributes syntax

In a DTD, attributes are declared using the ATTLIST declaration.

DTD - attributes example

<!ATTLIST?element-name?attribute-name?attribute-type?attribute-value>
DTD?實(shí)例:
<!ATTLIST?payment?type?CDATA?"check">
XML?實(shí)例:
<payment?type="check"?/>