08-09-2010, 04:35 PM | #1 |
Enthusiast
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? |
08-09-2010, 05:43 PM | #2 |
Wizard
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. |
Advert | |
|
08-09-2010, 07:52 PM | #3 | |
Enthusiast
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
|
Quote:
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> |
|
08-09-2010, 08:10 PM | #4 |
Enthusiast
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.
|
08-09-2010, 08:51 PM | #5 | |
Enthusiast
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
|
Quote:
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>) |
|
Advert | |
|
08-09-2010, 10:39 PM | #6 |
Wizard
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. |
08-10-2010, 12:05 AM | #7 | |
Enthusiast
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
|
Quote:
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. |
|
08-10-2010, 05:23 AM | #8 |
Wizard
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. |
08-10-2010, 08:30 AM | #9 |
Created Sigil, FlightCrew
Posts: 1,982
Karma: 350515
Join Date: Feb 2008
Device: Kobo Clara HD
|
XHTML is case-sensitive. <p> and <P> are not the same tag. Epubcheck is correct in pointing out a problem here.
|
08-10-2010, 10:44 AM | #10 |
Enthusiast
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. |
08-10-2010, 12:35 PM | #11 |
Enthusiast
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 12:47 PM. Reason: Spelling |
08-10-2010, 12:56 PM | #12 |
frumious Bandersnatch
Posts: 7,539
Karma: 19001081
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> But surely the class="calibre4" id="calibre_toc_15" bit was introduced by calibre, not Sigil? |
08-10-2010, 01:08 PM | #13 | |
Enthusiast
Posts: 41
Karma: 10
Join Date: Jul 2010
Device: Kindle
|
Quote:
Either way, this makes life way easier for future books by taking out that A tag. |
|
08-10-2010, 01:24 PM | #14 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
|
Thread Tools | Search this Thread |
|
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 11:45 PM |
Error during validation | macdafydd | ePub | 19 | 12-01-2010 07:07 PM |
ePub Validation Problem | rlarrett | ePub | 14 | 10-07-2010 02:06 AM |
Validation error | rrosenwald | Calibre | 10 | 10-01-2010 12:12 PM |
Epub validation problem | silentobserver | ePub | 3 | 08-16-2010 01:51 AM |