Mobileread
epub validator question
#1  rablampain 02-01-2020, 12:37 AM
I have a 600K HTML5 file with a very large TOC all validating under the W3C HTML validator but the EPUB validator finds errors in the conversion of this file into an EPUB file by Calibre.
The no 4 of the unzipped EPUB file is the first (repeated on every "a tag") to be found incorrect at line 11 by the EPUB validator and I have no idea what the problem could be. This split section of EPUB file in turn does not trigger any error on line no 11 by W3C HTML validator although it complained twice as expected about line no 1.

The error code is:

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")


And the converted HTML code is:

01 <?xml version='1.0' encoding='utf-8'?>
02 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr" xml:lang="en">
03 <head>
04 <title>My Title Here.</title>
05 <meta name="description" content="My metadata here."/>
06 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
07 <link href="stylesheet.css" rel="stylesheet" type="text/css"/>
08 <link href="page_styles.css" rel="stylesheet" type="text/css"/>
09 </head>
10 <body class="calibre pcalibre">
11 <a id="My_Link_Here" class="pcalibre"><h1 class="pcalibre h1nopba" id="calibre_pb_4">My Link Here<br class="pcalibre calibre3"/>Table Of Content</h1></a>
12 </body></html>


Can anyone suggest what the error is?

Thank you for your help.
Reply 

#2  Doitsu 02-01-2020, 04:17 AM
You'll need to wrap <a> tags in block level tags. For example:

<h1 class="pcalibre h1nopba" id="calibre_pb_4"><a id="My_Link_Here" class="pcalibre"></a>My Link Here<br class="pcalibre calibre3"/>Table Of Content</h1>
Reply 

#3  theducks 02-02-2020, 10:48 AM
Missing Block level tag

But I question the need for an <a> at the top of any file (just after the <body>
Jumping to that file should open at the top all by itself
Reply 

#4  rablampain 02-17-2020, 07:46 PM
Thank you, that fixed it.
Reply 

Today's Posts | Search this Thread | Login | Register