Skip to main content
AlisonS1
Inspiring
Nov 6, 2024 12:05 PM UTC
Answered

InDesign epub exports failing epub check

Why are these errors and how do I find the place to amend them (all RSC-005)? I've used ID Styles for both text and objects and am not a coder.

For content.opf error reads:

(line 2, col 105):
Error while parsing file: attribute "xml:lang" not allowed here; expected attribute "id"

 

Line 2 = <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="bookid" xml:lang="en-GB">

 

In the cover.xhtml lines 3–11 read

<head>
<title>Cover</title>
</head>
<body>
<figure style="text-align:center;">
<img src="image/1.png" alt="Cover of It&apos;s The Truth: Making The Only Ones by Simon Wright" style="max-width:100%;" role="doc-cover" />
</figure>
</body>
</html>
 
And the errors are defined as
1) (line 8, col 38)
Error while parsing file: element "figure" not allowed anywhere; 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")
2) (line 9, col 143):
Error while parsing file: attribute "role" not allowed here; expected attribute "class", "dir", "height", "id", "ismap", "lang", "longdesc", "title", "usemap", "width" or "xml:lang"
3) (line 11, col 9):
Error while parsing file: element "body" incomplete; 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")
 
While in the text.xhtml the file, lines 9–13 read:
<div class="_idGenObjectLayout-1">
<figure id="_idContainer000" class="_idGenObjectStyleOverride-1">
<img class="_idGenObjectAttribute-1" src="image/Only_Ones_2nd_edition_cover.png" alt="" />
</figure>
</div>
 
And the 2 errors are:

 (line 10, col 69):
Error while parsing file: element "figure" not allowed anywhere; expected the element end-tag, text or element "a", "abbr", "acronym", "address", "applet", "b", "bdo", "big", "blockquote", "br", "cite", "code", "del", "dfn", "div", "dl", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "i", "iframe", "img", "ins", "kbd", "map", "noscript", "ns:svg", "object", "ol", "p", "pre", "q", "samp", "script", "small", "span", "strong", "sub", "sup", "table", "tt", "ul" or "var" (with xmlns:ns="http://www.w3.org/2000/svg")

 

(line 11, col 95):
Error while parsing file: element "figure" not allowed anywhere; expected the element end-tag, text or element "a", "abbr", "acronym", "address", "applet", "b", "bdo", "big", "blockquote", "br", "cite", "code", "del", "dfn", "div", "dl", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "i", "iframe", "img", "ins", "kbd", "map", "noscript", "ns:svg", "object", "ol", "p", "pre", "q", "samp", "script", "small", "span", "strong", "sub", "sup", "table", "tt", "ul" or "var" (with xmlns:ns="http://www.w3.org/2000/svg")

Laura BradyCorrect answer
Inspiring
Nov 7, 2024 6:42 PM UTC

The issue is that you are exporting EPUB 2. If you switch to exporting EPUB 3, these validation errors will disappear. 

 

Are you consciously choosing EPUB 2? If yes, may I ask why? There is no reason at all to stick to this older format. 

16 replies

Laura BradyCorrect answer
Inspiring
Nov 7, 2024 6:42 PM UTC

The issue is that you are exporting EPUB 2. If you switch to exporting EPUB 3, these validation errors will disappear. 

 

Are you consciously choosing EPUB 2? If yes, may I ask why? There is no reason at all to stick to this older format. 

Translate
AlisonS1
AlisonS1Author
Inspiring
Nov 7, 2024 7:24 PM UTC

I'm just going with what ID offers, which is reflowable or fixed. Not spotted any number variants 

Translate
Inspiring
Nov 7, 2024 7:32 PM UTC

There is a place at the start of the EPUB export wizard in ID where you can choose EPUB 2 or 3. It is now set to export EPUB 3 by default, but EPUB 2.0.1 is an option in the drop-down menu. See the attached screenshot. 

Translate
James Gifford—NitroPress
Legend
Nov 6, 2024 3:34 PM UTC

Oh, fer frak's sake — I didn't see that coming. I did write a technical note here in the forum about the change, but in haste, ignorance or blind trust I asumed it was compliant with the implemented standards. We once again have InDesign jumping ahead on export changes and "compliance" that is not in step with the downstream EPUB world.

 

The short take is that images are now exported in a <figure> element, not a <div>. I have no idea who said what to whom or when about this change being 'compliant' or necessary; all I know is that the 2025 rush to accessiblity (for the EU, mainly) is creating something a lot like <chaos> in the EPUB world.

 

The only solutions are (1) ignore the errors and assume that any downstream sales portal or reader understands what to do with a <figure> even if EPUBcheck is clueless so far; (2) manually edit all <figure> elements to <div> (which may not work) or just wait until the reality end of EPUB catches up with the navel-gazing end of it.

Translate
AlisonS1
AlisonS1Author
Inspiring
Nov 7, 2024 9:03 AM UTC

Love it! Thanks James.

1 it is then.

Translate
James Gifford—NitroPress
Legend
Nov 7, 2024 4:27 PM UTC

I'll just add that part of the reason this went past me is that no EPUB reader so far  — including Thorium, Calbre and Kindle Previewer — so much as seems to notice the change. I long ago gave up trying to follow the talmudic twists of the EPUB standard but I assume these tools implemented this detail correctly, and as awkwardly as it does, InDesign is slowly moving towards greater standards compliance. Why EPUBcheck would choke on it is... just evidence of the field's fragmentation.

 

I just wouldn't worry about it unless an actual distribution portal like KDP, Ingram, Apple etc. rejects it. I think it's a bit more of consequence to CSS stylists who may go bonkers trying to figure out why existing projects now spurn any image adjustments. 🙂

Translate