Skip to content
EPUBCheck · Package document (OPF)

EPUBCheck OPF-007: forbidden prefix mapping

Updated:

EPUBCheck OPF-007 is a warning message: “Re-declaration of reserved prefix "…".” The prefix attribute declares a mapping that EPUB does not allow there, most often a re-declaration of a reserved prefix. EPUBCheck reports four related cases: OPF-007 (a warning) and OPF-007a, OPF-007b and OPF-007c (errors).

The official message

Re-declaration of reserved prefix "%1$s".

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

%1$s, %2$s… are filled in with the file, value or element EPUBCheck found.

Typical causes

  • OPF-007: a reserved prefix such as dcterms, rendition, schema or a11y is mapped to a URI other than its reserved one, usually because a prefix attribute was copied from another book.
  • OPF-007a: the prefix "_" is declared, which EPUB forbids.
  • OPF-007b: a prefix is mapped to the URI of a default vocabulary, whose terms must be used without a prefix.
  • OPF-007c: a prefix is mapped to the Dublin Core /elements/1.1/ namespace, which belongs in an xmlns:dc declaration, not in the prefix attribute.

How to fix it

  1. Find the prefix attribute on the package element of the .opf file.
  2. Delete the mapping EPUBCheck names: reserved prefixes work without being declared, default vocabularies take no prefix, and "_" cannot be declared.
  3. Keep Dublin Core as xmlns:dc="http://purl.org/dc/elements/1.1/" on the package or metadata element.
  4. If the attribute is now empty, remove it.

When it's not this

If a prefix is used in a property but never declared, that is OPF-028; if the attribute's syntax is wrong, that is a variant of OPF-004.

Also reported as

  • OPF-007a (error): Invalid prefix mapping: prefix "_" must not be declared.
  • OPF-007b (error): Invalid prefix mapping: default vocabulary "%1$s" must not be re-declared.
  • OPF-007c (error): Invalid prefix mapping: a prefix to the Dublin Core /elements/1.1/ namespace must not be declared

Terms used here

Other OPF messages

  • OPF-006 Invalid prefix declaration: URI "…" is not a valid URI.
  • OPF-005 Invalid prefix declaration: URI for prefix "…" doesn’t exist.
  • OPF-004 Invalid prefix declaration: leading or trailing whitespace is not allowed.

Sources

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

FAQ

What does EPUBCheck OPF-007 mean?

EPUBCheck OPF-007 is a warning message: “Re-declaration of reserved prefix "…".” The prefix attribute declares a mapping that EPUB does not allow there, most often a re-declaration of a reserved prefix. EPUBCheck reports four related cases: OPF-007 (a warning) and OPF-007a, OPF-007b and OPF-007c (errors).

Is OPF-007 an error?

OPF-007 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.