Every element used in a valid document must be declared in the DTD with an element definition as follows
<!ELEMENT name content>
where name is the element name and content specifies what children the element may or must have in what order. The content of the element definition may be:
<!ELEMENT email (#PCDATA)>
<!ELEMENT contact (e-mail)>
<!ELEMENT contact (e-mail | phone)>
<!ELEMENT name (first,last)>
<!ELEMENT image EMPTY>
<!ELEMENT image ANY>
<!ELEMENT name (first*,middle?,last+)>Given this definition, all the following name elements are valid:
<name> <first>Samuel</first> <middle>Lee</middle> <last>Jackson</last> </name> <name> <first>Samuel</first> <first>Michael</first> <last>Jackson</last> </name> <name> <last>Jackson</last> <last>Keaton</last> </name>The following definition says that name may have any number of first, middle, and last children in any order:
<!ELEMENT name (first | middle | last)*>The following is a notable example of mixed content, that is text interleaved with markup, which is typical content in narrative documents. It specifies that name may have any number of first, middle, and last children in any order possibly interleaved with parsed character data:
<!ELEMENT name (#PCDATA | first | middle | last)*>Given this definition, the following name element is valid:
<name> First comes the first name: <first>Samuel</first> Then the middle one: <middle>Lee</middle> Last comes the last name: <last>Jackson</last> Not very surprising indeed! </name>It's worth noticing that this is the only way to indicate mixed content: you can only say that an element contains any number of any elements from a list in any order, as well as parsed character data. Moreover, the keyword #PCDATA must be the first in the list. Finally, consider the following alternative definition for name:
<!ELEMENT name (first | last | (first,last))>This apparently innocuous definition is in fact invalid. The error that you get if you try to validate a document with this definition is something like: Content model of name is not determinist.