MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   ePub (https://www.mobileread.com/forums/forumdisplay.php?f=179)
-   -   "Error while parsing file 'Multiple occurrences of the 'cover-image' property " (https://www.mobileread.com/forums/showthread.php?t=311603)

BKh 10-17-2018 05:31 PM

"Error while parsing file 'Multiple occurrences of the 'cover-image' property "
 
1 Attachment(s)
I wonder if some kind stranger can help me figure this out.

I did a epub validation check here:http://validator.idpf.org/

And got these errors:
Code:

Type        File        Line        Position        Message
ERROR        OEBPS/content.opf        13        13        Error while parsing file 'Multiple occurrences of the 'cover-image' property (number of 'cover-image' items: 2).'.
ERROR        OEBPS/content.opf        14        99        Package resource 'OEBPS/Images/cover.png' is declared in several manifest item.
ERROR        OEBPS/Text/guide.xhtml        18        64        Referenced resource could not be found in the EPUB.

In the manifest section of content.opf, it occurs twice:
Code:

<item id="cover_png" href="Images/cover.png" media-type="image/png" properties="cover-image"/>
<item id="cover.png" href="Images/cover.png" media-type="image/png" properties="cover-image"/>

So, could someone explain if I should keep the line with id="cover_png" or id="cover.png"? I have never had to mess around with these before.

I attached the whole content.opf, but here are some parts that may help solve the problem.
This is the start of the content.opf file:

Code:

<?xml version="1.0" encoding="utf-8"?>
<package version="3.0" unique-identifier="BookID" xmlns="http://www.idpf.org/2007/opf" prefix="rendition: http://www.idpf.org/vocab/rendition/#">
  <metadata xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/">
    <dc:title id="title1">Aṅguttaranikāya: Numbered Discourses</dc:title>
    <meta refines="#title1" property="title-type">main</meta>
    <dc:creator id="create1">Bhikkhu Sujato</dc:creator>
    <dc:language>en</dc:language>
    <meta name="Sigil version" content="0.9.9" />
    <dc:identifier id="BookID">urn:uuid:73b4776c-6ed1-41ca-8b0e-b766ded5e300</dc:identifier>
    <meta property="dcterms:modified">2018-10-17T15:05:30Z</meta>
    <meta name="cover" content="cover.png" />
  </metadata>
  <manifest>
    <item id="cover_png" href="Images/cover.png" media-type="image/png" properties="cover-image"/>
    <item id="stylesheet" href="Styles/stylesheet.css" media-type="text/css"/>
    <item id="toc" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
    <item id="Section0001.xhtml" href="Text/Section0001.xhtml" media-type="application/xhtml+xml"/>
    <item id="guide" href="Text/guide.xhtml" media-type="application/xhtml+xml"/>
    <item id="an1.1-10" href="Text/an1.1-10.xhtml" media-type="application/xhtml+xml"/>
    <item id="an1.11-20" href="Text/an1.11-20.xhtml" media-type="application/xhtml+xml"/>

This is in the middle:

Code:

    <item id="an11.983-991" href="Text/an11.983-991.xhtml" media-type="application/xhtml+xml"/>
    <item id="an11.992-1151" href="Text/an11.992-1151.xhtml" media-type="application/xhtml+xml"/>
    <item id="cover.png" href="Images/cover.png" media-type="image/png" properties="cover-image"/>
    <item id="cover.xhtml" href="Text/cover.xhtml" media-type="application/xhtml+xml" properties="svg"/>
    <item id="intro.xhtml" href="Text/intro.xhtml" media-type="application/xhtml+xml"/>
    <item id="SourceSerifPro-Bold.otf" href="Fonts/SourceSerifPro-Bold.otf" media-type="application/vnd.ms-opentype"/>
    <item id="SourceSerifPro-BoldIt.otf" href="Fonts/SourceSerifPro-BoldIt.otf" media-type="application/vnd.ms-opentype"/>
    <item id="SourceSerifPro-It.otf" href="Fonts/SourceSerifPro-It.otf" media-type="application/vnd.ms-opentype"/>
    <item id="SourceSerifPro-Regular.otf" href="Fonts/SourceSerifPro-Regular.otf" media-type="application/vnd.ms-opentype"/>
    <item id="navid" href="Text/nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
  </manifest>
  <spine toc="toc">
    <itemref idref="cover.xhtml"/>
    <itemref idref="intro.xhtml"/>
    <itemref idref="Section0001.xhtml"/>

And this is the end:

Code:

    <itemref idref="an11.502-981"/>
    <itemref idref="an11.982"/>
    <itemref idref="an11.983-991"/>
    <itemref idref="an11.992-1151"/>
    <itemref idref="navid"/>
  </spine>
  <guide>
    <reference type="toc" title="Table of Contents" href="Text/guide.xhtml"/>
    <reference type="text" title="Text" href="Text/an1.1-10.xhtml"/>
    <reference type="title-page" title="Title Page" href="Text/intro.xhtml"/>
    <reference type="cover" title="Cover" href="Text/cover.xhtml"/>
  </guide>
</package>


Tex2002ans 10-17-2018 07:30 PM

Did you use some other program to create this EPUB (InDesign->EPUB, Word->EPUB, [...])?

Or did you try to zip this manually?

Or did you use Sigil/Calibre?

Something like this shouldn't occur normally...

* * *

Looks like these are the two issues:

1. The book is expecting you to have a file guide.xhtml, but it isn't in the EPUB.

Maybe whatever tool you used to create the EPUB forgot to create this file. Looks like it may have been the name of your HTML Table of Contents (did you accidentally delete it?).

2. It looks like your cover file is cover.png, so you should be able to delete this extra line:

Code:

<item id="cover_png" href="Images/cover.png" media-type="image/png" properties="cover-image"/>
Explanation: There's only supposed to be a single cover for the EPUB... but whatever tool you used accidentally points to the cover twice.

BKh 10-18-2018 12:00 AM

Thank you so much for your message.

Quote:

Looks like these are the two issues:

1. The book is expecting you to have a file guide.xhtml, but it isn't in the EPUB.

2. It looks like your cover file is cover.png, so you should be able to delete this extra line:

Code:

<item id="cover_png" href="Images/cover.png" media-type="image/png" properties="cover-image"/>
Explanation: There's only supposed to be a single cover for the EPUB... but whatever tool you used accidentally points to the cover twice.
So, the original file came from a website that auto-generates the file from content on the site. I don't know what they were using on the backend to create it but I will ask.

The file I posted was from a later version that I worked on in Sigil. At one point in the process I used the epub2 to epub3 export plugin.

I went back to the original file and found this...
Code:

<item id="cover_png" properties="cover-image" href="images/cover.png" media-type="image/png"/>
<item href="images/cover.png" id="img001" media-type="image/png"/>

Different from what I posted in the OP, but clearly still not right.

The validator in Sigil had never had any issue before or after converting it to epub3. In fact the only reason I am hopping down this rabbit hole is that the cover isn't showing up when the book is uploaded to google books/play. But for now I'm just trying to get it to validate so I can rule that out.

Thanks again! I still need to investigate point 1 in your very helpful message.

Tex2002ans 10-18-2018 12:33 AM

Quote:

Originally Posted by BKh (Post 3761746)
I went back to the original file and found this...
Code:

<item id="cover_png" properties="cover-image" href="images/cover.png" media-type="image/png"/>
<item href="images/cover.png" id="img001" media-type="image/png"/>

Different from what I posted in the OP, but clearly still not right.

[...]

In fact the only reason I am hopping down this rabbit hole is that the cover isn't showing up when the book is uploaded to google books/play.

Another step you might want to try if you want to have take an easy way out.

Open the EPUB in Sigil:

1. Delete the cover.xhtml + cover.png files. This should clean up the content.opf and remove any crappy/broken references to those files.

2. Add the cover.png back into the EPUB, then Tools > Add Cover. This should create a clean cover.xhtml file, and also assign the correct Cover metadata to the proper image.

Quote:

Originally Posted by BKh (Post 3761746)
The validator in Sigil had never had any issue before or after converting it to epub3. But for now I'm just trying to get it to validate so I can rule that out.

What validator? FlightCrew? That one is only good for a rough check (and isn't really maintained any more).

The actual true EPUB validator you'll have to use is always epubcheck (it's the one that stores use).

DNSB 10-18-2018 01:28 AM

Looking at your content.opf, it looks as if almost every page in the original document is showing in the epub a separate file. Weird and wonderful...

DNSB 10-18-2018 01:33 AM

Quote:

Originally Posted by Tex2002ans (Post 3761752)
What validator? FlightCrew? That one is only good for a rough check (and isn't really maintained any more).

The actual true EPUB validator you'll have to use is always epubcheck (it's the one that stores use).

I suspect the F7 (Well-Formed Check Epub) tool is being referred to. FlightCrew has it's uses for epub2 but will not check an epub3.

BKh 10-18-2018 12:42 PM

Quote:

Originally Posted by Tex2002ans (Post 3761752)
Another step you might want to try if you want to have take an easy way out.

Open the EPUB in Sigil:

1. Delete the cover.xhtml + cover.png files. This should clean up the content.opf and remove any crappy/broken references to those files.

2. Add the cover.png back into the EPUB, then Tools > Add Cover. This should create a clean cover.xhtml file, and also assign the correct Cover metadata to the proper image.

OK, I did this but this was still in the content.opf:
Code:

<manifest>
    <item id="cover_png" href="Images/cover.png" media-type="image/png" properties="cover-image"/>

So I deleted the <item... and used the Tools>Add Cover feature in Sigil. (FWIW, I thought I did this already, but I guess not)

Yay! This is the only thing in the .opf:
Code:

<item id="cover.png" href="Images/cover.png" media-type="image/png" properties="cover-image"/>
except for this, but I guess this is ok:
Code:

<meta content="cover.png" name="cover" />
  </metadata>

I ran the check again and tada! It checks out. Thank you so much. I fixed the guide.xhtml problem too. It was a bad link.

Thanks everyone!

DiapDealer 10-18-2018 05:14 PM

Quote:

Originally Posted by DNSB (Post 3761763)
I suspect the F7 (Well-Formed Check Epub) tool is being referred to. FlightCrew has it's uses for epub2 but will not check an epub3.

And as we have to point out repeatedly ... Sigil's Well-Formed Check is not a "Validator" of any kind. Sigil itself is out of the EPUB validation game. Validation is achieved through plugins: there are plugins available for Flightcrew (EPUB2) or EpubCheck (EPUB2/3).

The Well-Formed Check (F7) in Sigil checks that there is no malformed xhtml (all tags properly closed, no improper nesting). Nothing more.

So it's not surprising at all that Sigil itself wouldn't catch a well-formed OPF file with an out of spec (EPUB spec) entry.

BKh 10-18-2018 07:57 PM

1 Attachment(s)
Quote:

Originally Posted by DiapDealer (Post 3762103)
And as we have to point out repeatedly ... Sigil's Well-Formed Check is not a "Validator" of any kind. Sigil itself is out of the EPUB validation game.

In fairness, the Well-Formed Check produces this...
https://www.mobileread.com/forums/at...1&d=1539903103

Could it just say "results"?

If it has to be pointed out so often, it might be good to have a message in the results reminding people.

In any case, thank you for the reminder. :2thumbsup

BKh 10-18-2018 08:30 PM

BTW, now when I upload the book to google books the cover displays perfectly.

Thanks again for everyone's help.

DiapDealer 10-19-2018 10:00 AM

Quote:

Originally Posted by BKh (Post 3762148)
In fairness, the Well-Formed Check produces this...

Could it just say "results"?

If it has to be pointed out so often, it might be good to have a message in the results reminding people.

In any case, thank you for the reminder. :2thumbsup

Any "checking" routine (which also includes "real" validation plugins) will share that same Results widget, so any title will need to be a one-size-fits-all kind of thing. We will, however, take it under advisement about adding a message to the end of the Well-Formed Check results.

BKh 10-19-2018 02:19 PM

Quote:

Originally Posted by DiapDealer (Post 3762395)
Any "checking" routine (which also includes "real" validation plugins) will share that same Results widget, so any title will need to be a one-size-fits-all kind of thing. We will, however, take it under advisement about adding a message to the end of the Well-Formed Check results.

Thanks for all you help. I can't imagine creating ebooks without Sigil.


All times are GMT -4. The time now is 10:54 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.