EPUBCheck error
HTM-004: Irregular DOCTYPE
This error means the declared or missing DOCTYPE does not match the rules EPUBCheck is applying to that content document.
Example report
HTM-004: Irregular DOCTYPE: found "", expected
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">".
OEBPS/Text/cover_page.xhtml
Why it happens
The example above is from an EPUB 2-style book whose XHTML content is being checked against XHTML 1.1 rules. It can occur when a formatter omits the declaration, uses an HTML5 declaration in EPUB 2 content, or mixes document conventions.
Do not add an XHTML 1.1 DOCTYPE to every EPUB. EPUB 3 content uses HTML syntax and is not repaired by blindly applying an EPUB 2 declaration.
How to fix the observed EPUB 2 case
- Confirm the package identifies the book as EPUB 2 and that the referenced file is XHTML content.
- Open
OEBPS/Text/cover_page.xhtmlor the path named in your report. - Add or correct the XHTML 1.1 declaration before the root
<html>element:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Keep the XML namespace and the rest of the XHTML valid, save the file, repackage if necessary, and run EPUBCheck again. For an EPUB 3 book, inspect the package version and content syntax instead of copying this EPUB 2 declaration.
What a passing result means
Removing HTM-004 confirms this declaration issue is resolved. An overall EPUBCheck pass does not guarantee acceptance by Amazon KDP or another retailer.