6

I've received an ePub with the following structure:

Abstract Container:
META-INF/
   container.xml
   varience.txt
OEBPS/
   content.opf
   Great Expectations.opf
   cover.html
   chapters/
      chapter01.html
      chapter02.html
      … other OPS files for the remaining chapters …

There are two opf files contained within it, but only content.opf is referenced by the abstract container's container.xml

I think this valid as I don't get any errors thrown by epubcheck, but I'm having trouble understanding why an ePub would be structured this way. I'm also a little confused by the Open Packaging Format (OPF) 2.0.1 spec as it says under the package conformance section: "it may consist of one or more XML files, but only one may use the file extension .opf."

So I guess my questions are:

  1. Is it valid to have more than one .opf file? In what circumstances would this be useful?
  2. Is it valid to list an .opf file that isn't referenced in the container.xml?
  3. Is it valid to list multiple .opf files if they are referenced in container.xml? How would this be represented in container.xml? How would an ePub reader decide which to use?
6

I am not sure what your two .opf files contain, but the EPUB 2.0.1 specs http://www.idpf.org/doc_library/epub/OCF_2.0.1_draft.doc (section 10.1) say:

The <rootfiles> element MUST contain at least one element that has a media-type of “application/oebps-package+xml”. Only one element with a media-type of “application/oebps-package+xml” SHOULD be included. The file referenced by the first element that has a media-type of “application/oebps-package+xml” will be considered the EPUB rootfile. The EPUB rootfile (the OPF package file) MUST NOT be encrypted.

This means that you can have more OPF files in the container, and even reference them in the container.xml, but only the first will be considered the primary one. (And, I add, most real world reading systems will ignore the others.)

Note, however, that you can have multiple renditions inside the EPUB container:

<?xml version="1.0"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="OEBPS/My Crazy Life.opf" media-type="application/oebps-package+xml" />
<rootfile full-path="PDF/My Crazy Life.pdf" media-type="application/pdf" />
</rootfiles>
</container>

So, just having another OPF file is fine, as long as you list it in the <manifest> (of the OPF actually referenced in the container.xml). For any functional purpose, it will be ignored by the reading system.

Comment 1: I still think that the EPUB you have been given is probably the result of some sort of experimentation, and having two OPF files is the result of some mistake.

Comment 2: in theory, having multiple OPF files is a way to pack multiple renditions of the same publication inside the same EPUB container. The IDPF has a working group on multiple renditions: http://www.idpf.org/epub/renditions/multiple/

  • Thanks! I think you're right that the epub I'm dealing with is the result of experimentation but if it's a valid epub then I need to take the scenario into account. I think that we'll take the suggested approach and use the first and ignore the others. – Matthew Dunlop Jun 9 '14 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.