View Full Version : epub check tells me "Version not found" in my content.opf


NASCARaddicted
01-24-2013, 09:57 PM
Hello

I hope you people can help me (again).

I am working on creating an epub file, but I am doing it all on my own, no Sigil, no Calibre, just me and my html editor (Notepad ++).

So far I followed some helpful links from the Internet. I saw many examples about how the content.opf should look. I think I got it finished. However, when I use the epub checker (or similar validator tools) to see if it is valid, I receive an error.

Error in content.opf
Version not found.

So it seems as if something is missing in my content.opf file. But I am not sure what. As I said, I found some examples and just used them in my content.opf

Personally, I think it is somewhere in the first part, with the metadata. But as I said, I just copied some examples from the net ...

Here is my content.opf file for that book, I hope you guys can help me.

<?xml version="1.0" encoding="UTF-8"??>
<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>Testbook</dc:title>
<dc:creator opf:role="aut">Test Author</dc:creator>
<dc:language>de</dc:language>
<dc:rights>Public Domain</dc:rights>
<dc:publisher>NASCARaddicted</dc:publisher>
<dc:identifier id="BookID" opf:scheme="UUID">Testbook</dc:identifier>
</metadata>

<manifest>
<item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml" />
<item id="style" href="default.css" media-type="text/css" />
<item id="Kapitel00" href="Split-Test000.html" media-type="application/xhtml+xml" />
<item id="Kapitel01" href="Split-Test001.html" media-type="application/xhtml+xml" />
<item id="Kapitel02" href="Split-Test002.html" media-type="application/xhtml+xml" />
<item id="Kapitel03" href="Split-Test003.html" media-type="application/xhtml+xml" />
<item id="Kapitel04" href="Split-Test004.html" media-type="application/xhtml+xml" />
<item id="Kapitel05" href="Split-Test005.html" media-type="application/xhtml+xml" />
<item id="Kapitel06" href="Split-Test006.html" media-type="application/xhtml+xml" />
<item id="Kapitel07" href="Split-Test007.html" media-type="application/xhtml+xml" />
<item id="Kapitel08" href="Split-Test008.html" media-type="application/xhtml+xml" />
<item id="Kapitel09" href="Split-Test009.html" media-type="application/xhtml+xml" />
<item id="Kapitel10" href="Split-Test010.html" media-type="application/xhtml+xml" />
<item id="Kapitel11" href="Split-Test011.html" media-type="application/xhtml+xml" />
<item id="Kapitel12" href="Split-Test012.html" media-type="application/xhtml+xml" />
<item id="Kapitel13" href="Split-Test013.html" media-type="application/xhtml+xml" />
<item id="Cover" href="images/cover.jpg" media-type="image/jpg" />
<item id="Kapitel14" href="Split-Test014.html" media-type="application/xhtml+xml" />
<item id="Logo" href="images/Logo.jpg" media-type="image/jpg" />
</manifest>

<spine toc="ncx">
<itemref idref="Kapitel00" />
<itemref idref="Kapitel01" />
<itemref idref="Kapitel02" />
<itemref idref="Kapitel03" />
<itemref idref="Kapitel04" />
<itemref idref="Kapitel05" />
<itemref idref="Kapitel06" />
<itemref idref="Kapitel07" />
<itemref idref="Kapitel08" />
<itemref idref="Kapitel09" />
<itemref idref="Kapitel10" />
<itemref idref="Kapitel11" />
<itemref idref="Kapitel12" />
<itemref idref="Kapitel13" />
<itemref idref="Kapitel14" />
</spine>

<guide>
<reference href="Kapitel00.html" type="cover" title="Cover"/>
</guide>

</package>

Thanks for your help

dgatwood
01-25-2013, 12:38 AM
Well, you have a parse error in the first line. It should end with ?>, not ??>.

Beyond that, the error you're seeing can be caused by the name of the OPF file not matching what is in the META-INF/container.xml file. Paths in the container.xml file are relative to the root, not relative to the file, so if your structure is


bookdir/content.opf
bookdir/META-INF/container.xml


then your container.xml file should say:

<?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>

With things set up that way, your OPF file appears to pass validation on my machine (to the extent that an OPF file can pass validation without the actual content files, that is).

NASCARaddicted
01-25-2013, 05:50 AM
thanks so far.

The "??" was, because I copied it from the internet ...

But I noticed another thing. Of course I also looked at epubs created with calibre. And in this case, the content is all in the main path. But like suggested on the internet, I created an OEBPS folder to contain all the content. After editing the path in the container.xml file, the "version error" is gone (but therefore I found many other errors in the other files.

Thanks for your help.

Toxaris
01-25-2013, 07:44 AM
I recommend looking at the site from Jedisaber. He explains the ePUB2 format quite well and it will help you.

NASCARaddicted
01-26-2013, 09:10 AM
I recommend looking at the site from Jedisaber. He explains the ePUB2 format quite well and it will help you.

I already found Jedisabers site. And the funny thing is: I copied his content.opf ... with the 2 question marks :D but yeah, his site is really helpful.

As I said, the "version error" was gone, once I changed the path in the content.opf file. After that I got some other errors, but mostly they were caused by bad bracketing (a closing tag too much) and stuff like that.

The only error I still get is about a jpg file. ("not conform to the opf standard"). I guess I will take the same html and jpg files and run them through Calibre and compare the outcoming code with my own code. If that doesn't help me then I will post it here.

But again, thanks for your helpful input.

Edit: never mind what I said earlier, about the jpg file. It seems as if I found the error. I used

media-type="image/jpg"

After changing the "jpg" to "jpeg", the image seems to be fine according to epub checker.