Thread: epubcheck Error
View Single Post
Old 05-20-2024, 12:52 AM   #8
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,978
Karma: 169810634
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by mdpeterson42 View Post
OK, so my new issue is the following error:

Error while parsing file: element "a" not allowed here; expected element "address", "blockquote", "del", "div", "dl", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "ins", "noscript", "ns:svg", "ol", "p", "pre", "script", "table" or "ul" (with xmlns:ns="http://www.w3.org/2000/svg")

This is in reference to a line that was a location for a link elsewhere in the book. In the HTML code, I used:

<a name="TCOOS"> <p class="subtitle">THE COLOUR OUT OF SPACE</P>

In calibre, it changed that to:

<a id="TCOOS"> <p class="subtitle" id="calibre_toc_16">THE COLOUR OUT OF SPACE</p>
<p class="subsubtitle" id="calibre_toc_17">

I assume I can't just take out "a" but I am not sure what to replace it with.

Thank you!
You have to surround the <a>...</a> with a block level element such as <div> or <p>. Right now you don't seem to even have the closing </a> required (ePub does not allow unclosed elements though most web browsers will disregard them. Not to mention that name="..." is not valid in ePub2 but is valid in ePub3.

For ePub 3, a file with the <a name="TCOOS"> by itself checked by epubcheck give a:

Code:
FATAL(RSC-016): Fatal Error while parsing file: The element type "a" must be terminated by the matching end-tag "</a>".
so <a name="TCOOS"></a> does not trigger an error.

For ePub 2, a file with the <a name="TCOOS"> by itself checked by epubcheck gives 3 error messages:

Code:
ERROR(RSC-005): Error while parsing file: attribute "name" not allowed here; expected attribute "accesskey", "charset", "class", "coords", "dir", "href", "hreflang", "id", "lang", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type" or "xml:lang"
ERROR(RSC-005): Error while parsing file: element "a" not allowed here; expected element "address", "blockquote", "del", "div", "dl", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "ins", "noscript", "ns:svg", "ol", "p", "pre", "script", "table" or "ul" (with xmlns:ns="http://www.w3.org/2000/svg")
FATAL(RSC-016): Fatal Error while parsing file: The element type "a" must be terminated by the matching end-tag "</a>".
Adding the </a> for ePub 2 doesn't help much since the <a>...</a> must be inside a block level element (div, p, see the documentation for the full list).

Generally, I find converting an ePub3 input file to an output ePub2 file with calibre is a total pain. Setting the EPUB output to output version 3 helps but still not a great experience.
DNSB is offline   Reply With Quote