EPUBCheck OPF-005: prefix without a URI
Updated:
EPUBCheck OPF-005 is an error message: “Invalid prefix declaration: URI for prefix "…" doesn’t exist.” A prefix in the prefix attribute has no URI after it. Each prefix exists only to stand for a vocabulary URI, so a mapping without one cannot be used by any property in the package document.
The official message
Invalid prefix declaration: URI for prefix "%1$s" doesn’t exist.
- 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
%1$s, %2$s… are filled in with the file, value or element EPUBCheck found.
Typical causes
- A mapping cut short, such as "ibooks:" at the end of the attribute.
- A URI deleted while editing, leaving only the prefix and its colon.
- A line break or quote in the wrong place that splits the URI away from its prefix.
How to fix it
- Find the prefix EPUBCheck names in the prefix attribute of the package element.
- Write each mapping as the prefix name, a colon, one space and the vocabulary URI, and separate mappings with whitespace, for example
prefix="ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/ foaf: http://xmlns.com/foaf/spec/". - If the prefix is not used by any property in the package document, delete the whole mapping instead.
When it's not this
If a URI is there but malformed, EPUBCheck reports OPF-006; if the layout of spaces and colons is the problem, it reports a variant of OPF-004.
Terms used here
Other OPF messages
Sources
Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.