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-20-2024, 02:11 PM   #16
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
My next struggle is line breaks or emphasis within block quotes. Here are two examples:

Error:
28, 79: Error while parsing file: text 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")
28, 100: Error while parsing file: element "br" 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")

Here is the code:

<blockquote class="calibre8">Come hither, my lads, with your tankards of ale,<br class="calibre4"/>


Error:
26, 94: Error while parsing file: text 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")
26, 114: Error while parsing file: element "em" 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")

Here is the code:

<blockquote class="calibre8">“—the vastness, profundity, and unsearchableness of His works, <em class="calibre6">which have a depth in them greater than the well of Democritus.</em>”</blockquote>


Thank you all again!
mdpeterson42 is offline   Reply With Quote
Old 05-20-2024, 03:25 PM   #17
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,166
Karma: 4917720
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by soniya View Post
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.
Are you a Bot?
Karellen is offline   Reply With Quote
Advert
Old 05-20-2024, 04:37 PM   #18
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,979
Karma: 56143930
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by mdpeterson42 View Post
My next struggle is line breaks or emphasis within block quotes. Here are two examples:

Error:
28, 79: Error while parsing file: text 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")
28, 100: Error while parsing file: element "br" 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")

Here is the code:

<blockquote class="calibre8">Come hither, my lads, with your tankards of ale,<br class="calibre4"/>


Error:
26, 94: Error while parsing file: text 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")
26, 114: Error while parsing file: element "em" 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")

Here is the code:

<blockquote class="calibre8">“—the vastness, profundity, and unsearchableness of His works, <em class="calibre6">which have a depth in them greater than the well of Democritus.</em>”</blockquote>


Thank you all again!
em cant have a class=.
If you need to style it, then use span
theducks is online now   Reply With Quote
Old 05-20-2024, 04:48 PM   #19
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
Quote:
Originally Posted by theducks View Post
em cant have a class=.
If you need to style it, then use span
Interesting, since I had just used <em> in HTML and Calibre added the class. So if I just did <em> and </em>, would that work? Weirdly, this only seems to be an issue in blockquote and not elsewhere (there are italics sprinkled throughout the book).

Thank you!
mdpeterson42 is offline   Reply With Quote
Old 05-20-2024, 04:58 PM   #20
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,670
Karma: 87654321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Exporting from LO Writer via Save As docx would give something like
Code:
<p class="quote">“—the vastness, profundity, and unsearchableness of His works, <span class="emp">which have a depth in them greater than the well of Democritus.</span>”</p>
Some might argue <blockquote> is semantic info. But often it's just a different paragraph style, a hangover from HTML3 or something.
Any change within <hn>, <p> or <blockquote> is always needing a <span>

Consider editing odt files in LO Writer using paragraph styles and an "export" via Save As in docx for Calibre (don't open the docx in LO Writer).
All the paragraph styles map 1:1 to <p> with 1:1 CSS and all character styles map 1:1 to <span>
I use Edit Span & Divs tool to fix back any <p class="some heading" etc to be <h2 class="some heading" etc, less than a minute.

Last edited by Quoth; 05-20-2024 at 05:01 PM.
Quoth is offline   Reply With Quote
Advert
Old 05-20-2024, 05:04 PM   #21
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,670
Karma: 87654321
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by mdpeterson42 View Post
Interesting, since I had just used <em> in HTML and Calibre added the class. So if I just did <em> and </em>, would that work? Weirdly, this only seems to be an issue in blockquote and not elsewhere (there are italics sprinkled throughout the book).

Thank you!
<em> has semantic meaning. If it's italics for some reason other than emphasis, then <i>text</i> is better.
Blockquote isn't really needed at all if it has a class setting margins, indents, padding, font etc. A <p class="whatever" is fine.

KISS principle. Don't multiply entities unless needed.
Quoth is offline   Reply With Quote
Old 05-20-2024, 06:20 PM   #22
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,643
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 theducks View Post
em cant have a class=.
If you need to style it, then use span
<em> and <i> can have a class. I've seen it done.
JSWolf is online now   Reply With Quote
Old 05-20-2024, 09:08 PM   #23
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,798
Karma: 147879470
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Code:
<blockquote class="calibre8">Come hither, my lads, with your tankards of ale,<br class="calibre4"/>
Code:
<blockquote class="calibre8">“—the vastness, profundity, and unsearchableness of His works, <em class="calibre6">which have a depth in them greater than the well of Democritus.</em>”</blockquote>
What is even funnier is that when I ran those code snippets through epubcheck using epub3 (I did add the closing blockquote to the first snippet), there were no errors.

When I repeated running epubcheck using epub2, I needed to add a block tag inside the blockquotes which oddly is what first error message posted for both was complaining about. I tested with <div> and <p>, any of the others would likely work.

Code:
<blockquote class="calibre8"><p>Come hither, my lads, with your tankards of ale,<br class="calibre4"/></p></blockquote>

<blockquote class="calibre8"><p>“—the vastness, profundity, and unsearchableness of His works, <em class="calibre6">which have a depth in them greater than the well of Democritus.</em>”</p></blockquote>
Perhaps either more practice or an online CSS course and a review of the ePub specifications might be in order.

Last edited by DNSB; 05-20-2024 at 09:11 PM.
DNSB is offline   Reply With Quote
Old 05-21-2024, 12:01 AM   #24
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,262
Karma: 74007256
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
Or maybe, use an editting tool like sigil to create the epub.
PeterT is offline   Reply With Quote
Old 05-21-2024, 03:35 PM   #25
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
Quote:
Originally Posted by PeterT View Post
Or maybe, use an editting tool like sigil to create the epub.
That was what I thought I was doing with Calibre!
mdpeterson42 is offline   Reply With Quote
Old 05-21-2024, 03:52 PM   #26
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,262
Karma: 74007256
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
Quote:
Originally Posted by mdpeterson42 View Post
That was what I thought I was doing with Calibre!
I actually mean for the editing of it; not a conversion from html to epub

Sent from my Pixel 7a using Tapatalk
PeterT is offline   Reply With Quote
Old 05-21-2024, 04:02 PM   #27
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,643
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.
The best solution (IMHO) is to convert your eBook to text. Then load the text into MS Word or Libra Office. Use styles to set the styles you want. Then take the DocX file and convert it to ePub and clean it up from there. There should be a lot less errors.
JSWolf is online now   Reply With Quote
Old 05-21-2024, 04:04 PM   #28
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,643
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 PeterT View Post
Or maybe, use an editting tool like sigil to create the epub.
calibre does have an editor. The problem (I think) is the HTML has too many errors in it.
JSWolf is online now   Reply With Quote
Old 05-21-2024, 04:52 PM   #29
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,798
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
That was what I thought I was doing with Calibre!
calibre's conversion has some issues with the ePub standards since ePub implements a subset of the CSS2/3 and enforces some html/xhtml bits that have been deprecated for many browsers. For instance, most browsers do not require the <!DOCTYPE> anymore while the ePub specifications still mandate this.

My process when I must convert HTML to ePub is to do the conversion in calibre since it gets rid of much of the header cruft that is not used/needed for an ePub. After this I open the ePub in Sigil and do the cleanup and any editing in there. Sigil as an ePub editor is a lot more concerned with being ePub specification compliant than calibre and that makes my life a bit easier.

The other posters here who suggest using either Microsoft Word or LO Writer saving as docx and then converting that with calibre or importing to Sigil as being the easier path are correct as long as the author is careful to use styles to format the document (header, paragraph, etc.).

I've received some .docx files where the author treated the screen as a glass typewriter and they are a pain to deal with. With those, the easiest route I've found is to save the file as a text file and then add the styling in Sigil.
DNSB is offline   Reply With Quote
Old 05-23-2024, 11:05 AM   #30
mdpeterson42
Member
mdpeterson42 began at the beginning.
 
Posts: 23
Karma: 10
Join Date: May 2024
Device: Kindle
Thank you all for the thoughts; I really appreciate it.

I am curious why you all are saying Sigil is easier to use for editing than Calibre. They both seem about the same to me, so I wonder if Sigil has a feature I am not taking advantage of. I tried "Mend Code" but that did not seem to do anything. Honestly, all of the HTML functions just fine as HTML - it's just a matter of not knowing the proper epub syntax for some of it.

It seems that <div> </div> works in the blockquotes in place of the line break, though in Sigil with the Flightcrew plugin, I then received this error, which I had not gotten with epubchecker - "Error schema not satisfied : no character data is allowed by content model near column 157". This just refers to a </blockquote> tag, so I am really not sure what the issue is:

<blockquote class="calibre8">“—the vastness, profundity, and unsearchableness of His works, which have a depth in them greater than the well of Democritus."</blockquote>

Also, <span> did not work inside the blockquotes for italics. I think I am just going to drop the italics from any blockquotes and call it a day.

Maybe it would have been cleaner to just do this all in Word from the beginning using styles, but I thought the HTML would have been better. But at this point, with over 6000 lines of HTML, I think it is going to be easier to just fix the errors than start from scratch on the formatting. Most of it works fine. Next time, I'll use a paragraph style instead of the <blockquote> tag!
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:14 AM.


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