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

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 08-09-2010, 03:35 PM   #1
luthar28
Enthusiast
luthar28 began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
Validation Errors

Hi there,

I ran my epub through the 1.0.5 validation tool. Looks like I'm getting errors based on my HTML.

I received two types of reoccuring errors.

The first:

ERROR: c:\test.epub/nexus_ascension_split_019.html(8): bad value for attribute "id"

Second:

ERROR: c:\test.epub/nexus_ascension_split_018.html(53): element "br" from namespace "http://www.w3.org/1999/xhtml" not allowed in this context

Any ideas?
luthar28 is offline   Reply With Quote
Old 08-09-2010, 04:43 PM   #2
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
The second is easy. <br> is not allowed in XHTML. Change it in <br />.

De first is probably a wrong value for id (look at line number) in reference to the nxc or opf file.
Toxaris is offline   Reply With Quote
Advert
Old 08-09-2010, 06:52 PM   #3
luthar28
Enthusiast
luthar28 began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
Quote:
Originally Posted by Toxaris View Post
The second is easy. <br> is not allowed in XHTML. Change it in <br />.

De first is probably a wrong value for id (look at line number) in reference to the nxc or opf file.
I like the easy ones. Fixed the <br> to <br />

The second was that I had 'id' start with a digit...so I just changed that. Easy.

I'm still getting problems with H3 and <a> tags. This is what I have:

<a class="Chapter" id="c1_1"><h3>5 DAYS LEFT</H3></a>

After I import it into Calibre, change it to an E-pub, then open it in Sigil, it <h3 class="calibre12" id="calibre_toc_8"><a class="calibre7" id="c1_1">EA</a></h3>

I can see how to change the <a> tag (remove the class, I suppose...change it to a straight div) but what's wrong with the h3 tag?

But it's even weird how I have it <a><h3></h3></a> and calibre turns it into <h3><a></a></h3>
luthar28 is offline   Reply With Quote
Old 08-09-2010, 07:10 PM   #4
Lexicon
Enthusiast
Lexicon will become famous soon enoughLexicon will become famous soon enoughLexicon will become famous soon enoughLexicon will become famous soon enoughLexicon will become famous soon enoughLexicon will become famous soon enough
 
Posts: 44
Karma: 542
Join Date: Dec 2007
Device: Sony PRS-505
<h3> is a block tag and <a> is an inline one. I'm not sure it is valid to put a block element inside an inline element, but even if it is I'm not surprised a parser/writer would reverse the two. You couldn't really call it a bug either as the resulting code is functionally identical.
Lexicon is offline   Reply With Quote
Old 08-09-2010, 07:51 PM   #5
luthar28
Enthusiast
luthar28 began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
Quote:
Originally Posted by Lexicon View Post
<h3> is a block tag and <a> is an inline one. I'm not sure it is valid to put a block element inside an inline element, but even if it is I'm not surprised a parser/writer would reverse the two. You couldn't really call it a bug either as the resulting code is functionally identical.
So how should it be coded? What I'm trying to do is set hyperlinks to target Chapter headers.

Thus: <a class="Chapter" id="c0_1"><h3>THE TWINS</h3></A>

The class chapter does a page break before. Every error is based on these two (<a> and <h3>)
luthar28 is offline   Reply With Quote
Advert
Old 08-09-2010, 09:39 PM   #6
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
Very easy, the answer is:
<h3><a id="c0_1" />THE TWINS</h3>
Calibre and Sigil were trying to fix it for you.

An epub's xhtml body can only contain block elements (div, p, blockquote, ul, , h1, etc). Text and anchors must be contained in a block element of some sort. Since your anchor here is merely acting as a target for an external reference, there's no need to wrap it around the text either, it just needs to sit next to it.
charleski is offline   Reply With Quote
Old 08-09-2010, 11:05 PM   #7
luthar28
Enthusiast
luthar28 began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
Quote:
Originally Posted by charleski View Post
Very easy, the answer is:
<h3><a id="c0_1" />THE TWINS</h3>
Calibre and Sigil were trying to fix it for you.

An epub's xhtml body can only contain block elements (div, p, blockquote, ul, , h1, etc). Text and anchors must be contained in a block element of some sort. Since your anchor here is merely acting as a target for an external reference, there's no need to wrap it around the text either, it just needs to sit next to it.
Oh, geez, that was easy too

Last question (honestly, it is...I'm down to my last error). I'm getting this error: element 'img' from namespace not allowed in this context.

The code in question (from the source) is

<img alt="Nexus Ascension" class="backcover" src="back_cover.jpg">

The css for class is: img.backcover {width:100px;max-width:40%; margin-top:3em;}

I have another img earlier (using the exact same naming conventions) and it passes okay.
luthar28 is offline   Reply With Quote
Old 08-10-2010, 04:23 AM   #8
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
You should have guessed by now....

Replace <img ....> by <img ... />. Within XHTML you need an ending tag, like <p></p>. Since some tags don't have an ending (like <BR> and <IMG>), you can usually solve it by replacing > by />. Another 'famous' one is <HR>.

I also found that epubcheck doesn't like it when you use upper and lowercase mixed. So for example <P>...</p>. So make sure you either do only upper or lowercase to avoid confusion.
Toxaris is offline   Reply With Quote
Old 08-10-2010, 07:30 AM   #9
Valloric
Created Sigil, FlightCrew
Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.
 
Valloric's Avatar
 
Posts: 1,982
Karma: 350515
Join Date: Feb 2008
Device: Kobo Clara HD
Quote:
Originally Posted by Toxaris View Post
I also found that epubcheck doesn't like it when you use upper and lowercase mixed. So for example <P>...</p>. So make sure you either do only upper or lowercase to avoid confusion.
XHTML is case-sensitive. <p> and <P> are not the same tag. Epubcheck is correct in pointing out a problem here.
Valloric is offline   Reply With Quote
Old 08-10-2010, 09:44 AM   #10
luthar28
Enthusiast
luthar28 began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
Thanks to everyone's reply.

This has helped a ton and my document has finally been validated.
luthar28 is offline   Reply With Quote
Old 08-10-2010, 11:35 AM   #11
luthar28
Enthusiast
luthar28 began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
Okay, I thought I had it all figured out. First book has been validated. Then applied those coding changes to second. I am now experiencing the following error: element a from namespace not allowed in this context.

The code is as follows: <h2><a class="chapter" id="c1_1">MK#1: MAJOR KARNAGE</a></h2><h3>CHAPTER ONE</h3>

When I open it in sigil, it has changed it to:

<p><a class="chapter" id="c1_1">MK#1: MAJOR KARNAGE</a></p>

<h3 class="calibre4" id="calibre_toc_15">CHAPTER ONE</h3>

So it has stripped out the h2 and replaced it with <p>.

Any ideas?

Last edited by luthar28; 08-10-2010 at 11:47 AM. Reason: Spelling
luthar28 is offline   Reply With Quote
Old 08-10-2010, 11:56 AM   #12
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Try with:

Code:
<h2 id="c1_1">MK#1: MAJOR KARNAGE</h2><h3>CHAPTER ONE</h3>
(there's usually no need to use <a>)

But surely the class="calibre4" id="calibre_toc_15" bit was introduced by calibre, not Sigil?
Jellby is offline   Reply With Quote
Old 08-10-2010, 12:08 PM   #13
luthar28
Enthusiast
luthar28 began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
Quote:
Originally Posted by Jellby View Post
Try with:

Code:
<h2 id="c1_1">MK#1: MAJOR KARNAGE</h2><h3>CHAPTER ONE</h3>
(there's usually no need to use <a>)

But surely the class="calibre4" id="calibre_toc_15" bit was introduced by calibre, not Sigil?
This worked perfectly -- thanks a million. Works great by taking out the <a> tag...though I wonder why the hell it worked for the proceeding book (exact same coding) but not this one?

Either way, this makes life way easier for future books by taking out that A tag.
luthar28 is offline   Reply With Quote
Old 08-10-2010, 12:24 PM   #14
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Quote:
Originally Posted by Valloric View Post
XHTML is case-sensitive. <p> and <P> are not the same tag. Epubcheck is correct in pointing out a problem here.
That explains it then. Never knew that, sounds silly. Oh well, easily enough avoided.
Toxaris 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
What's this validation error and how to fix it. Adjust ePub 9 06-28-2011 10:45 PM
Error during validation macdafydd ePub 19 12-01-2010 06:07 PM
ePub Validation Problem rlarrett ePub 14 10-07-2010 01:06 AM
Validation error rrosenwald Calibre 10 10-01-2010 11:12 AM
Epub validation problem silentobserver ePub 3 08-16-2010 12:51 AM


All times are GMT -4. The time now is 05:36 AM.


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