The syntax for declaring an element in a DTD is as follows:
<!ELEMENT elementName (allowed element contents)>
Element names must begin with a letter but cannot begin with the letters "xml" in either upper or lower case.
These three letters are reserved for the specification itself. In addition, you cannot use the colon character in an element name because it is reserved for other purposes.
Declaring Elements that contain Text or other elements
The keyword ANY is used to specify that an element can contain text or other elements using the following syntax:
<!ELEMENT elementName ANY>
Here is an example DTD element declaration that declares the CREDIT-CARD element may contain either text or other elements:
<!ELEMENT CREDIT-CARD ANY>
Declaring elements that contain only text
When an element will contain only character data, declare the element in this manner:
<!ELEMENT elementName (#PCDATA)>
If only #PCDATA is specified, any text (but only text) can be included in the declared element.
This requirement means that no child elements may be present in the element within which #PCDATA is specified.
Declaring Child Elements
When one element will contain other elements, this information must be specified in the element declaration. When an element contains multiple elements, you may use the DTD syntax characters outlined in the DTD symbols table. The table below contains DTD symbols and indicates the various symbols and their meanings in the context of DTDs:
The following Slide Show shows an example of how you specify information in the element declaration: