ePUB won’t validate because OPF file missing? Check container.xml

Just had a frustrating issue in building a new ePUB where the validation (thanks Threepress) failed saying the OPF file was missing. Even though it was there clear as day in the source files.

If you do have an .OPF file but get this error, then the issue is not with this file at all, but with container.xml (which lives in the META-INF folder). This file does little more than point to your .OPF file. The error therefore arises if it points in the wrong direction.

In my instance the issue was caused by using an ePUB template/shell with a different default value for the filename and path to the .OPF. Note if I’d been paying attention the error message gives you all the information needed to resolve the issue since it reports a different filename for the .OPF to the one created. If they don’t match then container.xml is the culprit.

Here’s the all important line in container.xml. Make sure the name and match match your own construction.

<rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>