Document type declaration

The document type declaration contains or points to markup declarations that provide a grammar for a class of documents. This grammar is known as a document type definition, or DTD. The document type declaration defines constraints on the sequence and nesting of tags, attribute values, names and formats of external references, and so forth. You can edit the document type declaration to change its name, but the name must always be the same as the name of the root element. Changing the name in either the document type declaration or the root element automatically changes the name in the other.

Adding DTDs

You can add an identifier pointing to an external DTD subset, and you can add an internal DTD subset. If you supply both external and internal subsets, entity and attribute-list declarations in the internal subset take precedence over those in the external subset.

Public identifiers

An external identifier can include a public identifier that an XML processor can use to generate an alternative URI. If an alternative URI cannot be generated, the URI provided in the system identifier is used. External identifiers without a public identifier are preceded by the keyword SYSTEM. External identifiers with a public identifier are preceded by the keyword PUBLIC.

NoteExporting metadata If you specify a system or public identifier and/or an internal subset in the Document Type Declaration dialog box, a DTD cannot be generated when the data is exported to XML. A MetaDataType of XMLDTD! is ignored. For more information about the properties that control the export of metadata, see “Exporting metadata”.

Examples

These are examples of valid document type declarations.

An external system identifier:

<!DOCTYPE d_dept_listing SYSTEM "d_dept_listing.dtd">

An external system identifier with a public identifier:

<!DOCTYPE d_test PUBLIC "-//MyOrg//DTD Test//EN"
"http://www.mysite.org/mypath/mytest.dtd">

An external system identifier with an internal DTD. The internal DTD is enclosed in square brackets:

<!DOCTYPE d_orders 
   SYSTEM "http://www.acme.com/dtds/basic.dtd"[
   <!ELEMENT Order (Date, CustID, OrderID, Items*)>
   <!ELEMENT Date (#PCDATA)>
   <!ELEMENT CustID (#PCDATA)>
   <!ELEMENT OrderID (#PCDATA)>
   <!ELEMENT Items (ItemID, Quantity)>
   <!ELEMENT ItemID (#PCDATA)>
   <!ELEMENT Quantity (#PCDATA)>
]>