View Full Version : Error during validation


macdafydd
05-01-2010, 12:47 PM
I have written a script to produce an ebook in epub format from data stored locally.

Upon validation of the epub file, one error is returned:

ERROR: ROE.epub: length of first filename in archive must be 8, but was 22

The zip command I used to compress the files was as follows:

zip -Xr9D ROE.epub mimetype * .DS_Store

(All the files are in place, including mimetype.)

Any ideas as to what I am doing wrong?

Toxaris
05-01-2010, 03:38 PM
The mimetype has to be packed first and uncompressed.

macdafydd
05-01-2010, 04:15 PM
The mimetype has to be packed first and uncompressed.

And how can I do this, please?

pholy
05-01-2010, 06:25 PM
You just have to run zip twice:

zip -DX0 ROE.epub mimetype
zip -DrX9 ROE.epub META_INF .DS_Store

This assumes all your file are in .DS_STORE -- if you have your files all in the same directory as mimetype, you can't use the * because it will add mimetype in again. You will have to name all the files individually - or maybe use *.xhtml or some such...

macdafydd
05-01-2010, 07:45 PM
You just have to run zip twice..

Thank you. This removes the original error, but now results in:

ERROR: ROE.epub: Required META-INF/container.xml resource is missing

and produces an epub file with rubbish content (even though the individual files have correct content and were displayed correctly in the previously generated epub).

The folder in which the files for the ebook are stored does, however contain a folder named META-INF, which itself contains the file container.xml which contains the following text:

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

The full folder structure can be seen at http://perso.orange.es/nealegeorge/pics/ROE.png

Toxaris
05-02-2010, 04:52 AM
Open the epub as a zipfile (no idea how to do this on a Mac) and see if the folder structure in the zipfile is correct. The mimetype should be in the root and also the META-INF should be in the root.

If you used the command Pholy provided, there is a change that the xhtml files itself are not contained. You're wildcard in you're first command made sure that those files where contained.

Personally I use the following structure, which helps for me:
root
--mimetype (file)
--META-INF (folder)
--OEBPS (folder)
--xhtml files
--fonts (folder, when used)
--css (folder)
--images (folder)

If you use a folder structure like this, you're container.xml should read:


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


You can of course omit the folder structure in the OEBPS folder and put everything in the root of OEBPS.

You're zip command would then be:

zip -DX0 ROE.epub mimetype
zip -DrX9 ROE.epub META_INF OEBPS


Good Luck.

macdafydd
05-02-2010, 05:47 AM
After some searching on the Web, I find that this is the most common problem with generating the epub file.

I have tried several solutions found here and there and have at last found one that actually works, resulting in a validation from http://threepress.org/document/epub-validate/

The following zip commands did the trick:

zip -q0X ROE.epub mimetype
zip -qXr9D ROE.epub *


Hope this will help others.

pholy
05-02-2010, 02:04 PM
Very good, Macdafydd - your two line solution will work for any directory structure - mine assumed all the content files were in .DS_STORE (Where did that come from?). And the reason the * doesn't re-add the mimetype file is that the default action is to 'freshen' an archive - add new files and update changed files - not to copy in all files.

the 'q' simply runs quietly, which is useful if this is done in a script, but normally I like to see what is happening

So, thank you for posting your final solution. - K coming your way

sueneu
11-23-2010, 07:46 PM
Thanks, MacDafydd, pholy, this pointed me in the right direction(s). I had the same "container.xml resource is missing" error.
Using MacDafydd's terminal code left me with the .DS_Store file in the EPUB package, so this worked for me:

zip -q0X Filename.epub mimetype
zip -qXr9D Filename.epub META-INF OEBPS -x \*.DS_Store

Toxaris
11-24-2010, 03:47 AM
You can also add the files to Sigil and then save of course...

sueneu
11-26-2010, 11:04 AM
Thanks, Toxaris! : )

wannabee
11-28-2010, 07:51 PM
So, just when it looks like this thread is done and dusted

I'm confused (don't laugh). I've been right clicking on the folder and selecting send to compressed zip folder from day one. They validate.

My process is
Export to ADE from InDesign
Change file type to zip
Extract files

Edit

Right click folder to compressed zip
Change file type to epub

Am I missing something here :blink:

Adjust
11-28-2010, 08:47 PM
The mimetype file needs to be uncompressed and at the top (from memory)
I use this Applescript
http://www.mobileread.com/forums/showthread.php?t=55681&highlight=epub+zip+mac

I've used since I started making them, without any issues...

wannabee
11-28-2010, 08:57 PM
Thank Adjust, I've just save that script to my dropbox for my macs at home.
So how come my epubs validate when I zip them all up together with a right click on the PC? Was it pot luck?

Adjust
11-28-2010, 09:07 PM
Thank Adjust, I've just save that script to my dropbox for my macs at home.
So how come my epubs validate when I zip them all up together with a right click on the PC? Was it pot luck?

I dunno about PC's
I'm assuming you are not actually extracting the epub, just working from withing the zip... i.e. not clicking on the "extract all" button.

There's a PC version of that script getting around here... But I guess you don't need to

wannabee
11-28-2010, 09:09 PM
Nope, I extract all. Then edit and zip them all back up !

Toxaris
11-29-2010, 03:57 AM
Then there is something strange going on or you are extremely lucky. I cannot imagine that a file created in that manner will pass the checks or is readably usable on readers beside the iPad.

Could you post a sample?

wannabee
11-29-2010, 07:38 AM
Whoo Hoo? Toaxaris. I like the extremely lucky part. Time to get a lottery ticket as well. That's how I've made ePubs since September when I learned you had to validate them. All that scripting for zipping in the previous posts looks like hard work but I guess that's where I'm headed unless I continue to be lucky.

I've worked macs since 1985 and when I saw Liz Castro's posts about unzippy this zippy-de-do-da that when I was just using my mouse I thought "I'm not going back to the mac for this game"

Like I said. Very confused.

I can't post my client's work publicly but I can email a confidential ePub for you to have a look at. I've been trying to get someone's attention for a couple of weeks now because I have twenty books to do and I don't want to find out I screwed up when I'm delivering the 19th book.

So that will be in the morning when I can find the validated ePubs at work.

I love the help you guys give. Plenty of Karma to you all.

Toxaris
11-29-2010, 08:13 AM
No problem, just sent something over. You can also just make one with dummy text. Just as long your method is the same...

wannabee
12-01-2010, 06:07 PM
No problem, just sent something over. You can also just make one with dummy text. Just as long your method is the same...

Thanks for the offer Toxaris. I'll just finish of some other work first and take you up on your offer.