Document Type Declaration

The DTD is a file that contains rules that the XML code in the file has to follow. It can be thought of as the grammar that the XML document must abide by in order to be a valid XML file.  When referencing and external DTD, there are two type declarations that can be used: PUBLIC and SYSTEM. PUBLIC should be used when the XML document will be under the rules of a publicly distributed DTD.  In other cases, SYSTEM should be used.  Below is an example of a declaration for a public DTD

Example: <!DOCTYPE html PUBLIC “-//FIND//IT//HERE//EN”



•   !DOCTYPE – Indicates to the XML processor that this code defines a DTD.

•   html – this portion specifies the root element of the XML document.  In this case, it is HTML.

•   PUBLIC – Indicates that this is a DTD that is publically available.

•   “-//FIND//IT…” – This is a definition of the public document.

•   “…” – This address provides the location of the DTD.

This entry was posted in XML Tutorial. Bookmark the permalink.

Leave a Reply

Your email address will not be published.