DOCTYPE Declaration

A DOCTYPE declaration can contain an internal and/or reference an external Document Type Definition subset

  • The SYSTEM identifier can be used to reference an external DTD grammar.

    <!DOCTYPE root-name SYSTEM "uri-reference">
  • The PUBLIC identifier can be used to 'name' the reference to an external DTD grammar.

    <!DOCTYPE root-name PUBLIC "public-identifier" "uri-reference">
  • The DOCTYPE declaration can also specify an internal DTD Grammar.

    <!DOCTYPE root [
      <!ELEMENT root (child)>
      <!ATTLIST root attribute #IMPLIED>
      
      ...
    
      <!ENTITY copy "©">
    ]>
    
    <root>
    	...
    </root>
    					
  • Or a combination of external references and internal DTD Grammars can be specified.

    <!DOCTYPE root SYSTEM "uri-reference" [
      <!ELEMENT root (child)>
      <!ATTLIST root attribute #IMPLIED>
      
      ...
    
      <!ENTITY copy "©">
    ]>
    
    <root>
    	...
    </root>
    					

    The internal grammar takes precedence for entity and attribute-list declaration.

    Note

    Elements cannot be declared more than once.

Note

Both the PUBLIC and the SYSTEM identifier can be used to identify alternative DTD grammars. (for instance when the uri-reference defined is an internet address, it would be faster to substitute this using a local file.)