Syntax DTD's


The general syntax for a Document Type Declaration is:

<!DOCTYPE root-element [SYSTEM OR PUBLIC FPI] "uri" [ 
<!-- internal declarations -->
]>

In XML, the root element of the document is the first element in the document (In XHTML, the root element is html - being the first element opened and last closed). The keywords SYSTEM and PUBLIC suggest what kind of DTD it is (one that is on a private system or one that is open to the public). If the "SYSTEM" keyword is chosen, the URI of the DTD may follow; if the PUBLIC keyword is chosen then the declaration must have a FPI (Formal Public Identifier) following it and then the URI of the DTD (the FPI for XHTML 1.1 is "-//W3C//DTD XHTML 1.1//EN").

The last part is called an internal subset which can be used to add/edit entities or add/edit elements. This is optional in XML.

Document Type Declarations are slightly different in SGML, where you may associate the public identifier with the system identifier, as it is in HTML.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">

No comments:

Post a Comment