To use a DTD, you must associate it with an XML document. A DTD can be internal or external. An internal DTD is inside the XML document that uses it. It appears in the DOCTYPE element, which immediately follows the XML declaration at the beginning of the document. An external DTD is in a separate file. An XML document that uses an external DTD specifies the path for the DTD in its DOCTYPE element. For example, the following DOCTYPE element specifies that bookstore is the root element in this XML document, and that the DTD that this document uses is stored in the file system at C:\mydir\bookstore.dtd: