Answers.Body: <p>I am not sure what your two <code>.opf</code> files contain, but the EPUB 2.0.1 specs <a href="http://www.idpf.org/doc_library/epub/OCF_2.0.1_draft.doc">http://www.idpf.org/doc_library/epub/OCF_2.0.1_draft.doc</a> (section 10.1) say:</p>
  
  <blockquote>
    <p>The <code>&lt;rootfiles&gt;</code> 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.</p>
  </blockquote>
  
  <p>This means that you can have more OPF files in the container, and even reference them in the <code>container.xml</code>, but only the first will be considered the primary one. (And, I add, most real world reading systems will ignore the others.)</p>
  
  <p>Note, however, that you can have multiple renditions inside the EPUB container:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"&gt;
  &lt;rootfiles&gt;
  &lt;rootfile full-path="OEBPS/My Crazy Life.opf" media-type="application/oebps-package+xml" /&gt;
  &lt;rootfile full-path="PDF/My Crazy Life.pdf" media-type="application/pdf" /&gt;
  &lt;/rootfiles&gt;
  &lt;/container&gt;
  </code></pre>
  
  <p>So, just having another OPF file is fine, as long as you list it in the <code>&lt;manifest&gt;</code> (of the OPF actually referenced in the <code>container.xml</code>). For any functional purpose, it will be ignored by the reading system.</p>
  
  <p>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.</p>
  
  <p>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: <a href="http://www.idpf.org/epub/renditions/multiple/">http://www.idpf.org/epub/renditions/multiple/</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-09T07:58:05.540Z
Answers.Text: 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.
Answers.UserDisplayName: Matthew Dunlop
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-06T17:58:42.917Z
Answers.LastActivityDate: 2014-06-06T18:16:05.953Z
Answers.LastEditDate: 2014-06-06T18:16:05.953Z
Answers.UserDisplayName: Alberto Pettarin
Body: <p>I've received an ePub with the following structure:</p>
  
  <pre><code>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 …
  </code></pre>
  
  <p>There are two opf files contained within it, but only content.opf is referenced by the abstract container's container.xml</p>
  
  <p>I <em>think</em> this valid as I don't get any errors thrown by epubcheck, but I'm having trouble understanding <em>why</em> an ePub would be structured this way. I'm also a little confused by the <a href="http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm" rel="noreferrer">Open Packaging Format (OPF) 2.0.1 spec</a> as it says under the <a href="http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section1.4.1.1" rel="noreferrer">package conformance section</a>: "it may consist of one or more XML files, but only one may use the file extension .opf."</p>
  
  <p>So I guess my questions are:</p>
  
  <ol>
  <li>Is it valid to have more than one .opf file? In what circumstances would this be useful?</li>
  <li>Is it valid to list an .opf file that isn't referenced in the container.xml?</li>
  <li>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?</li>
  </ol>
  
Tags: <epub><epubcheck><opf>
Title: Can an ePub 2.0 contain multiple .opf files?
UserDisplayName: Matthew Dunlop
ThreadText: # Can an ePub 2.0 contain multiple .opf files?
  
  (Asked by: username_0 on 2014-06-04)
  
  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](http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm) as it says under the [package conformance section](http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section1.4.1.1): "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?
  
  **Tags:** epub, epubcheck, opf
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-06-06. Score: 6 | Accepted answer
  
  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/>
  
  > **Comments:**
  > **username_0**: 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.  
  
  ---
  
  