View Full Version : Problems with ePub validation


a-name4epub
12-02-2010, 09:29 PM
I'm looking for advice on a couple of errors I'm seeing. One is " exists in the zip file, but is not declared in the OPF file" but the files in question Are declared and I've checked, rechecked, and even renamed some files in both the opf and nxc files and still they show up as errors. Similar errors for (mostly) the same files is "referenced resource exists, but not declared in the OPF file" - how does this happen?

Another is "hyperlink to resource outside spine" but these are links to files within the epub. I read elsewhere on this forum that "id" works as links within the epub. I tried that and got "elements must consist of well-formed character data or markup." Is something more needed? I put /> where normally there would be </a>.

One file gives me "text not allowed here" but it is xhtml the same as all the others (this is an epub with many xhtml files).

Thanks for any assistance with this. I thought I had it figured out before epubcheck!

Jellby
12-03-2010, 05:55 AM
I'm looking for advice on a couple of errors I'm seeing. One is " exists in the zip file, but is not declared in the OPF file" but the files in question Are declared and I've checked, rechecked, and even renamed some files in both the opf and nxc files and still they show up as errors. Similar errors for (mostly) the same files is "referenced resource exists, but not declared in the OPF file" - how does this happen?

Have you renamed them to filenames with no spaces or funny characters (like "test.xhtml")? Are the files referenced in the <manifest> section of the OPF? Try to post a minimal example that gives the problem.

Another is "hyperlink to resource outside spine" but these are links to files within the epub.

But the linked file must be listed in the <spine> section of the OPF, otherwise the system won't know what to do when you page forward/backward after following the link.

I read elsewhere on this forum that "id" works as links within the epub. I tried that and got "elements must consist of well-formed character data or markup." Is something more needed? I put /> where normally there would be </a>.

The "id" works as <a name="whatever"> in HTML. You can put an "id" attribute in any element and link to it with <a href="#whatever"> normally. For example:

<p id="first">This is a paragraph with an "id" attribute, so we can link to it elsewhere.</p>

<p>This is a second paragraph with a <a href="#first">link</a> to the first paragraph</p>

One file gives me "text not allowed here" but it is xhtml the same as all the others (this is an epub with many xhtml files).

You probably have some text or <img> directly under <body>, not inside any block element (<p> or <div>). Put <div> and </div> around the problem text and the error should disappear.

Toxaris
12-03-2010, 04:20 PM
Did you try Flightcrew as validation tool? It usually gives better info. The message "referenced resource exists, but not declared in the OPF file" can point to a reference of a file which is not present in the OPF or even the epub. Also keep the case in mind with the files. Do not change upper- and lowercase between references.