Following is a brief discussion of how to interpret DTDs.
The structure of a DTD can be seen by example:
<!-- Copyright (C) 1994, Siebel Systems, L.P., All rights reserved. -->
<!-- Siebel DTD Generation -->
<!ELEMENT BubbaFundsTransferSr (FundsTransferSR+) >
<!ELEMENT FundsTransferSR (ContactFinancialAccounts?,
ContactLastName?,
FundsTransferFromAccountNumber?,
FundsTransferToAccountNumber?,
FundsTransferDollarAmount?,
TransactionId?,
SRNumber?)>
<!ELEMENT ContactFinancialAccounts (#PCDATA) >
<!ELEMENT ContactLastName (#PCDATA) >
<!ELEMENT FundsTransferFromAccountNumber (#PCDATA) >
<!ELEMENT FundsTransferToAccountNumber (#PCDATA) >
<!ELEMENT FundsTransferDollarAmount (#PCDATA) >
<!ELEMENT TransactionId (#PCDATA) >
<!ELEMENT SRNumber (#PCDATA) >
The first two lines
<!-- Copyright (C) 1994, Siebel Systems, L.P., All rights reserved. -->
<!-- Siebel DTD Generation -->
are the header. The Siebel header will not be used in the XML template.
The remainder of the DTD defines the elements expected in the body of the XML document. Each line is called an "element declaration", as identified by the !ELEMENT label.
An element declaration typically has two parts:
In the example,
<!ELEMENT SRNumber (#PCDATA) >
SRNumber is the element name, and #PCDATA describes the contents as parsed character data.
Slightly more complicated is the line
<!ELEMENT FundsTransferSR (ContactFinancialAccounts?,
ContactLastName?,
FundsTransferFromAccountNumber?,
FundsTransferToAccountNumber?,
FundsTransferDollarAmount?,
TransactionId?,
SRNumber?)>
In this case, the contents of the element are a set of child elements, where each child's name is separated by a comma. Note that a "?", "*", or "+" following a child name indicates the number of instances of the element that are allowed (zero or more instances can be present between tags for "?" or "*"; zero or more instances must be present for "+").