10. DTD for Elements with Mixed Content

For an element that can contain both PCDATA and other elements use the #PCDATA, "|" and "*" signs in combination. The above mentioned combination can be used to declare that an element can contain zero or more occurrences of either/or element and PCDATA.

Example 10.1 Mixed Content Model Example
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE rootelement [
<!ELEMENT rootelement (#PCDATA|childelement1|childelement2)*>
<!ELEMENT childelement1 (#PCDATA)>
<!ELEMENT childelement2 (#PCDATA)>
	PCDATA Content
	<childelement2>Child element 2.</childelement2>

The mixed content model can only specify the names of child elements that can occur. A child elements order or number of occurrences cannot be set. Having these limitations it is not recommended to use the mixed content model. In most circumstances it is better to declare a new element that can hold PCDATA.