Skip to content
EPUBCheck · Package document (OPF)

EPUBCheck OPF-035: XHTML declared as text/html

Updated:

EPUBCheck OPF-035 is a warning message: “Media type "text/html" is not appropriate for XHTML/OPS.” A content document is declared as text/html in an EPUB 2 package; EPUB content documents are XHTML and need application/xhtml+xml. Reading apps may treat a text/html document as an unsupported type.

The official message

Media type "text/html" is not appropriate for XHTML/OPS.

EPUBCheck's suggestion: Use "application/xhtml+xml" instead.

Default severity
Warning. The EPUB is still valid, but something is likely to cause problems in some reading apps. EPUBCheck exits with 0 unless you pass --failonwarnings.
EPUBCheck version
5.4.0

Typical causes

  • Manifests generated by tools that treat chapters as web pages.
  • A manifest typed by hand using the familiar web media type.
  • Files renamed from .html without changing their declaration.

How to fix it

  1. Find the manifest items with media-type="text/html".
  2. Change them to media-type="application/xhtml+xml".
  3. Make sure the files are well-formed XHTML (closed tags, quoted attributes, the XHTML namespace); EPUBCheck will report any parsing errors after the change.

When it's not this

If the declared type is another deprecated EPUB 2 type, EPUBCheck reports OPF-037.

Terms used here

Other OPF messages

  • OPF-034 The spine contains multiple references to the manifest item with id "…".
  • OPF-036 Video type "…" might not be supported by reading systems
  • OPF-033 The spine contains no linear resources.
  • OPF-037 Found deprecated media-type "…".
  • OPF-032 Guide references "…" which is not a valid "OPS Content Document".
  • OPF-031 File listed in reference element in guide was not declared in OPF manifest: ….

Sources

Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.

FAQ

What does EPUBCheck OPF-035 mean?

EPUBCheck OPF-035 is a warning message: “Media type "text/html" is not appropriate for XHTML/OPS.” A content document is declared as text/html in an EPUB 2 package; EPUB content documents are XHTML and need application/xhtml+xml. Reading apps may treat a text/html document as an unsupported type.

Is OPF-035 an error?

OPF-035 is reported as warning by default. The EPUB is still valid, but something is likely to cause problems in some reading apps. EPUBCheck exits with 0 unless you pass --failonwarnings.