No declaration for element

The DTD does not declare an element the document uses.

The message, as the validator reports it
No declaration for element cc

Why it happens

  • An element from another version of the format, or a misspelt name.
  • The wrong DTD for the document.

How to fix it

Rename or remove the element, or declare it in the DTD with <!ELEMENT …> and allow it in its parent's content model. The content-model error that usually follows is the same problem.

Example

Validated against note.dtd, below.

Reports the error
<note id="n1">
  <to>Ana</to>
  <body>Hi</body>
  <cc>Ben</cc>
</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>