Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 12-04-2015, 09:59 AM   #1
crankypants
Hmm.
crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.
 
Posts: 124
Karma: 2016606
Join Date: Oct 2015
Device: Android 4.2 Google Play Reader
Errors while validating EPUB

I have a fun project where I'm making EPUBs for to see how it's made. I'm using the validator at http://validator.idpf.org/ and am getting some errors which I don't know how to handle.

ERROR 1. "Mimetype file entry is missing or is not the first file in the archive."

The mimetype file is actually in the EPUB. Here's my EPUB listing from 7zip.

Code:
   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2015-12-04 09:47:54 ....A          260          177  META-INF\container.xml
2015-12-04 09:24:16 ....A           20           20  mimetype
2015-12-04 09:47:54 ....A         1130          512  OEBPS\content.opf
2015-10-30 18:33:34 D....            0            0  OEBPS\images
2015-10-30 18:33:34 D....            0            0  OEBPS\styles
2015-12-04 09:32:10 ....A          943          522  OEBPS\styles\style01.css
2015-11-04 09:19:14 D....            0            0  OEBPS\Text
2015-12-04 09:47:54 ....A         1381          777  OEBPS\Text\00cover.xhtml
2015-12-04 09:47:54 ....A         9334         3678  OEBPS\Text\31book.xhtml
2015-10-30 18:33:34 D....            0            0  OEBPS\themes
2015-12-04 09:47:54 ....A         1675          611  OEBPS\toc.ncx
------------------- ----- ------------ ------------  ------------------------
                                 21449         7839  9 files, 4 folders

I have several more errors in OEBPS/content.opf

ERROR 2 on line 12 of content.opf: "Error while parsing file 'value of attribute "id" is invalid; must be an XML name without colons'."

Here's my whole content.opf file:

Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookId" version="2.0">
  <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
    <dc:title>Book of the Farm, 1844, Vol 2</dc:title>
    <dc:creator opf:role="aut">Henry Stephens, FRSE</dc:creator>
    <dc:language>en</dc:language>
    <dc:date opf:event="modification">2015-12-04</dc:date>
    <dc:identifier id="bookid" opf:scheme="ISBN">bookofthefarm-vol1-1847</dc:identifier>  </metadata>

<manifest>
  <item href="toc.ncx" id="ncx" media-type="application/x-dtbncx+xml" />
  <item href="Text/00cover.xhtml" id="00cover.xhtml" media-type="application/xhtml+xml" /> # THIS IS LINE 12
  <item href="Text/31book.xhtml" id="31book.xhtml" media-type="application/xhtml+xml" />
  <item href="styles/style01.css" id="style01.css" media-type="text/css" />
</manifest>

<spine toc="ncx">
  <itemref idref="00cover.xhtml" /> # LINE 18
  <itemref idref="31book.xhtml" /> # ERROR ON LINE 19
</spine>

<guide>
  <reference href="Text/00cover.xhtml" title="Cover" type="cover" />
</guide>
</package>
Line 12 needs an XML scheme attribute? What are the values of the scheme attribute?
crankypants is offline   Reply With Quote
Old 12-04-2015, 10:08 AM   #2
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,293
Karma: 78876004
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
The mimetype HAS to be the first file and HAS to be stored uncompressed.
PeterT is offline   Reply With Quote
Advert
Old 12-04-2015, 11:01 AM   #3
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
How are you zipping up the book?

You have to do mumb-jumbo with the info-zip command-line tools (the spell is documented in various places on the web), or alternatively use special tools designed specifically to pack up an EPUB (heavily advised). Otherwise you will certainly fail to do it properly.

The other error is, I believe, because an id cannot start with a number.
As you can tell, EpubCheck doesn't have good error messages. Try FlightCrew, which is usually a lot more clear about your actual problem.
eschwartz is offline   Reply With Quote
Old 12-04-2015, 12:02 PM   #4
crankypants
Hmm.
crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.
 
Posts: 124
Karma: 2016606
Join Date: Oct 2015
Device: Android 4.2 Google Play Reader
Quote:
The mimetype HAS to be the first file and HAS to be stored uncompressed.
An EPUB is just a zipped file with certain files and directories in it. How in the world do I force the mimetype file to not be compressed and be the first file using 7zip?

Why would the creators of EPUB even ask for something bizarre like that? There should be a mimetype file in there, and the EPUB validator should find it regardless of what physical order it has in the zip/epub file. Can someone help me understand?

Quote:
Try FlightCrew, which is usually a lot more clear about your actual problem.
Is Flightcrew free?
crankypants is offline   Reply With Quote
Old 12-04-2015, 12:12 PM   #5
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Quote:
Originally Posted by crankypants View Post
An EPUB is just a zipped file with certain files and directories in it. How in the world do I force the mimetype file to not be compressed and be the first file using 7zip?

Why would the creators of EPUB even ask for something bizarre like that? There should be a mimetype file in there, and the EPUB validator should find it regardless of what physical order it has in the zip/epub file. Can someone help me understand?



Is Flightcrew free?
Zip the mimetype first by itself uncompressed and then add the other items. The reason they wanted it that way is so the file could be identified as to filetype without having to unzip it using, for example, the Unix file command.

Flightcrew is a free program, part of Sigil.

Also try "BookId" with caps in the place.

Dale
DaleDe is offline   Reply With Quote
Advert
Old 12-04-2015, 12:18 PM   #6
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by crankypants View Post
ERROR 2 on line 12 of content.opf: "Error while parsing file 'value of attribute "id" is invalid; must be an XML name without colons'."
Code:
  <item href="Text/31book.xhtml" id="31book.xhtml" media-type="application/xhtml+xml" />
Ids in epub2 books must start with a letter.
Doitsu is offline   Reply With Quote
Old 12-04-2015, 12:20 PM   #7
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 73,620
Karma: 315126578
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by crankypants View Post
An EPUB is just a zipped file with certain files and directories in it. How in the world do I force the mimetype file to not be compressed and be the first file using 7zip?
If you were on a Mac, you could use my ePub zip/unzip AppleScript.

If you have access to a command-line zip, the commands (with the unzipped ePub directory as current directory)

zip -X0 <quoted form of ePubFilePath> mimetype
zip -rDX9 <quoted form of ePubFilePath> * -x mimetype
pdurrant is offline   Reply With Quote
Old 12-04-2015, 12:22 PM   #8
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
If you have a Windows machine, you can use ePubPack.
Doitsu is offline   Reply With Quote
Old 12-04-2015, 12:53 PM   #9
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by crankypants View Post
An EPUB is just a zipped file with certain files and directories in it. How in the world do I force the mimetype file to not be compressed and be the first file using 7zip?
Like I said, either use the magical incantation with zip.exe, as blessed by the IPDF, or special tools written specifically to "zip up an EPUB properly".

It is not enough to simply create a zipped folder with 7-Zip.

...

Didn't you mention somewhere you were using perl? Why not use the perl module for creating EPUB automatically as part of the scripting?

http://search.cpan.org/~oty/EBook-EPUB-0.6/


Quote:
Why would the creators of EPUB even ask for something bizarre like that? There should be a mimetype file in there, and the EPUB validator should find it regardless of what physical order it has in the zip/epub file. Can someone help me understand?
As DaleDe said, the mimetype is needed for the zipfile itself, not the unpacked representation.

Quote:
Is Flightcrew free?
It is released under the same umbrella as Sigil (these days, it is no longer a builtin but decoupled and turned into a plugin).

https://github.com/Sigil-Ebook/flightcrew

Binary releases as a Sigil plugin are available, but you should also be able to build it as a standalone gui or cli tool.
eschwartz is offline   Reply With Quote
Old 12-04-2015, 12:58 PM   #10
crankypants
Hmm.
crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.
 
Posts: 124
Karma: 2016606
Join Date: Oct 2015
Device: Android 4.2 Google Play Reader
It appears my root problem might be that 7-zip 15.16 cannot control compression, so the mimetype file gets compressed. Let me fix that first, I'm download info-zip right now and will try that.
crankypants is offline   Reply With Quote
Old 12-04-2015, 01:00 PM   #11
crankypants
Hmm.
crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.crankypants ought to be getting tired of karma fortunes by now.
 
Posts: 124
Karma: 2016606
Join Date: Oct 2015
Device: Android 4.2 Google Play Reader
Quote:
Originally Posted by Doitsu View Post
Code:
  <item href="Text/31book.xhtml" id="31book.xhtml" media-type="application/xhtml+xml" />
Ids in epub2 books must start with a letter.
All id attributes? Or just the ones for the xhtml files?

That's seriously archaic.
crankypants is offline   Reply With Quote
Old 12-04-2015, 01:06 PM   #12
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by crankypants View Post
All id attributes? Or just the ones for the xhtml files?

That's seriously archaic.
Go bring it up with the World Wide Web Consortium. They made the rule.

(Your chances of getting the HTML4 spec retroactively changed like that are zero to none.)
eschwartz is offline   Reply With Quote
Old 12-04-2015, 01:24 PM   #13
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,680
Karma: 23983815
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by crankypants View Post
All id attributes? Or just the ones for the xhtml files?
If ids that start with numbers are important to you, you'll have to generate an ePub3 book.
(Since ePub3 (mostly) supports HTML5 files, you can use ids that start with a number in HTML5 files, but nowhere else.)
Doitsu is offline   Reply With Quote
Old 12-04-2015, 04:28 PM   #14
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Quote:
Originally Posted by crankypants View Post
It appears my root problem might be that 7-zip 15.16 cannot control compression, so the mimetype file gets compressed. Let me fix that first, I'm download info-zip right now and will try that.
Info zip will be fine. I use it. I have 7zip for adding and viewing content.

Dale
DaleDe is offline   Reply With Quote
Old 12-04-2015, 04:46 PM   #15
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
Another very simple tool to work with ePub files is Tweak EPUB described in our wiki. This is a free program that will allow taking a ePub apart to edit the pieces. It will allow you to view the resultant ePub from inside the tool to view any changes you make prior to rebuilding the file.

Dale
DaleDe is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Validating Epub Thom* Editor 6 07-08-2015 04:17 AM
validating epub fails - how do I correct? BeccaPrice ePub 14 06-12-2013 02:01 PM
Validating epub returns warning writerkit Conversion 2 03-30-2013 02:35 AM
Issues validating EPUB for iPad godsmac Calibre 13 06-26-2011 09:02 PM


All times are GMT -4. The time now is 05:47 PM.


MobileRead.com is a privately owned, operated and funded community.