Element content does not follow the DTD
An element's children don't match its content model: order, count or which ones.
The message, as the validator reports it
Element note content does not follow the DTD, expecting (to , body), got (body to )
Why it happens
- Children in the wrong order. A comma in the content model means "in this order".
- A required child missing, or one appearing more often than
?,*or+allow.
How to fix it
The message gives the model the DTD expects and the children it got. Rearrange the children to match.
Example
Validated against note.dtd, below.
Reports the error
<note id="n1">
<body>Hi</body>
<to>Ana</to>
</note>
Fixed
<note id="n1">
<to>Ana</to>
<body>Hi</body>
</note>
note.dtd
<!ELEMENT note (to, body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT body (#PCDATA)>
<!ATTLIST note id ID #REQUIRED>