The Document Type Declaration

The document type declaration is the XML statement that declares the type of XML document and also identifies the DTD as being SYSTEM or PUBLIC. The document type declaration is as follows:

<!DOCTYPE name external pointer[internal subset]

In the DOCTYPE declaration statement, the name argument is the name of the root element. If the DTD is an external file, the external pointer argument after name is the combination of PUBLIC or SYSTEM, depending on where the DTD is located and the URI to the DTD. For example, if the DTD for the CarParts.xml were defined in the http://www.carheaven.com/dtds/CarParts.dtd, then the DOCTYPE declaration would have been

 <!DOCTYPE carparts SYSTEM "http://www.carheaven.com/dtds/CarParts.dtd"> ...

Get Java™ APIs for XML Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.