A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines rules for a specific type of document, including:
Names of elements, and how and where they can be used
The order of elements
Proper nesting and containment of elements
Element attributes
To apply a DTD to an XML document, you can:
Include the DTD's element definitions within the XML document itself.
Provide the DTD as a separate file, whose name you reference in the XML document.