Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 05-19-2024, 01:25 PM   #1
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
epubcheck Error

Hi all,

I am trying to publish my first book. I wrote it in HTML and converted it to epub using Calibre. On the Google Play Store, I received the following error on about half of my splits and I have no idea how to address them:

Error while parsing file: attribute "class" not allowed here; expected attribute "dir", "lang", "version" or "xml:lang"

Any thoughts would be greatly appreciated.
mdpeterson42 is offline   Reply With Quote
Old 05-19-2024, 01:38 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,662
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by mdpeterson42 View Post
Hi all,

I am trying to publish my first book. I wrote it in HTML and converted it to epub using Calibre. On the Google Play Store, I received the following error on about half of my splits and I have no idea how to address them:

Error while parsing file: attribute "class" not allowed here; expected attribute "dir", "lang", "version" or "xml:lang"

Any thoughts would be greatly appreciated.
There is no a lot anyone can do unless we see the code that has the errors and a few lines before and after.
JSWolf is offline   Reply With Quote
Advert
Old 05-19-2024, 01:46 PM   #3
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
Here is the code for the entire first split:

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" class="calibre">
<head>
<title>Unknown</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
<link rel="stylesheet" type="text/css" href="page_styles.css"/>
</head>
<body class="calibre1">
<p class="halftitle" id="calibre_toc_1">THE ULTIMATE H.P. LOVECRAFT</p>

<div class="calibre2" id="calibre_pb_1"></div>
</body></html>
mdpeterson42 is offline   Reply With Quote
Old 05-19-2024, 01:58 PM   #4
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,611
Karma: 23187563
Join Date: Dec 2010
Device: Kindle PW2
Delete the part marked in red.

<html xmlns="http://www.w3.org/1999/xhtml" class="calibre">
Doitsu is offline   Reply With Quote
Old 05-19-2024, 02:00 PM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,662
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by mdpeterson42 View Post
Here is the code for the entire first split:

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" class="calibre">
<head>
<title>Unknown</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
<link rel="stylesheet" type="text/css" href="page_styles.css"/>
</head>
<body class="calibre1">
<p class="halftitle" id="calibre_toc_1">THE ULTIMATE H.P. LOVECRAFT</p>

<div class="calibre2" id="calibre_pb_1"></div>
</body></html>
The class="calibre" is incorrect where it is.

The following code is correct.
Code:
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Unknown</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
<link rel="stylesheet" type="text/css" href="page_styles.css"/>
</head>
<body class="calibre1">
<p class="halftitle" id="calibre_toc_1">THE ULTIMATE H.P. LOVECRAFT</p>
<div class="calibre2" id="calibre_pb_1"></div>
</body>
</html>
JSWolf is offline   Reply With Quote
Advert
Old 05-19-2024, 02:20 PM   #6
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
Thank you both so much!
mdpeterson42 is offline   Reply With Quote
Old 05-19-2024, 11:54 PM   #7
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
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!
mdpeterson42 is offline   Reply With Quote
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: 36,857
Karma: 147879470
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
Old 05-20-2024, 01:16 AM   #9
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,170
Karma: 4949904
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
They look like headings. Why not use the correct heading tags?

<h2>THE COLOUR OUT OF SPACE</h2>
(or maybe <h3> depending on the books heading hierarchy)

and you can do away with all the other tags.
Karellen is online now   Reply With Quote
Old 05-20-2024, 02:37 AM   #10
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: 36,857
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Karellen View Post
They look like headings. Why not use the correct heading tags?

<h2>THE COLOUR OUT OF SPACE</h2>
(or maybe <h3> depending on the books heading hierarchy)

and you can do away with all the other tags.
The code looks more like they are a subtitle which I generally do not use header tags for since it makes the ToC a mess. My preference is to add the chapter number and subtitle to a title="CN: Subtitle" in the header.

I'm not sure what they are doing with the unterminated <a name="..."> though that may be an attempt to use them in the ToC generation. Hard to say without seeing the full ePub.
DNSB is offline   Reply With Quote
Old 05-20-2024, 05:06 AM   #11
soniya
Junior Member
soniya began at the beginning.
 
soniya's Avatar
 
Posts: 4
Karma: 10
Join Date: May 2024
Location: India
Device: none
Hey hi, review the HTML code to check compliance with EPUB specification. Replace class with permitted attributes like dir, lang, version, or xml:lang as needed. Validate the HTML code against the EPUB standard to resolve the parsing error.
soniya is offline   Reply With Quote
Old 05-20-2024, 11:25 AM   #12
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,662
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Do you actually need <a id="TCOOS">? If it's an ID in the Toc, dump it. You don't need it Just have the ToC link to the filename without the ID. There is no need for an ID at the top of the HTML file if it's just for an ID for the ToC.
JSWolf is offline   Reply With Quote
Old 05-20-2024, 11:43 AM   #13
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
Quote:
Originally Posted by JSWolf View Post
Do you actually need <a id="TCOOS">? If it's an ID in the Toc, dump it. You don't need it Just have the ToC link to the filename without the ID. There is no need for an ID at the top of the HTML file if it's just for an ID for the ToC.
I actually do need it, because I link to it from three different places in the book besides the TOC. So that's how I tell the links where to point. The crazy thing is that the epub actually works correctly (all the links get me to the right place throughout when using my Kindle or Google Books apps), but the error checker still flags it.
mdpeterson42 is offline   Reply With Quote
Old 05-20-2024, 12:00 PM   #14
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,611
Karma: 23187563
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by mdpeterson42 View Post
<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>
The <a> tag is missing the closing </a> tag. It also needs to be inside <p></p> or another block level tag.

Try this:

<p class="subtitle" id="calibre_toc_16"><a id="TCOOS"></a>THE COLOUR OUT OF SPACE</p>
Doitsu is offline   Reply With Quote
Old 05-20-2024, 02:00 PM   #15
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
Quote:
Originally Posted by Doitsu View Post
The <a> tag is missing the closing </a> tag. It also needs to be inside <p></p> or another block level tag.

Try this:

<p class="subtitle" id="calibre_toc_16"><a id="TCOOS"></a>THE COLOUR OUT OF SPACE</p>
That worked, thank you!
mdpeterson42 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EpubCheck Error gstock97 Editor 7 07-23-2021 08:58 AM
EPUBCheck error gsosigil Sigil 3 03-21-2021 06:24 PM
Epubcheck misses error exaltedwombat Sigil 12 09-24-2019 04:02 PM
Error epubcheck Buble ePub 43 08-15-2014 01:53 AM
Error on epubcheck Brazz ePub 5 09-01-2011 03:17 AM


All times are GMT -4. The time now is 10:28 PM.


MobileRead.com is a privately owned, operated and funded community.