EPUBCheck HTM-011: undeclared named entity
Updated:
EPUBCheck HTM-011 is an error message: “Entity is undeclared.” A named entity is used that the document does not declare. XML only knows &, <, >, " and ', so HTML names such as break the XHTML and the chapter may not open at all.
The official message
Entity is undeclared.
EPUBCheck's suggestion: Define the entity or use the numbered entity instead.
- Default severity
- Error. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.
- EPUBCheck version
- 5.4.0
Typical causes
- HTML entities such as , —, … or © pasted into XHTML.
- Text exported from a word processor or a web page, where HTML entity names are normal.
How to fix it
- Open the file EPUBCheck names (the message gives the path, line and column) in a text or EPUB editor such as Sigil, or unzip the EPUB and open it there.
- Replace each named entity with a numeric reference (  for a non-breaking space, — for an em dash, … for an ellipsis) or type the character itself in UTF-8.
- Search the whole book for
&followed by letters to catch the other occurrences at once. - Rebuild the EPUB and run EPUBCheck again to confirm the message is gone.
When it's not this
If the entity is declared in the DOCTYPE through an external file, the message is HTM-003.
Terms used here
Other HTM messages
HTM-010Namespace "…" is unusual for the prefix "epub".HTM-009The DOCTYPE provided is obsolete or irregular and can be removed.HTM-007Empty or whitespace-only value of attribute ssml:ph.HTM-004Irregular DOCTYPE: found "…", expected "…".HTM-003External entities are not allowed in EPUB v3 documents. External entity declaration found: ….HTM-001Any publication resource that is an XML-based media type must be a valid XML 1.0 document. XML version found: ….
Sources
Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.