Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

InDesign epub exports failing epub check

Community Beginner ,
Nov 06, 2024 Nov 06, 2024

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")

TOPICS
EPUB , Import and export
3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Nov 07, 2024 Nov 07, 2024

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
Community Expert ,
Nov 06, 2024 Nov 06, 2024

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 07, 2024 Nov 07, 2024

Love it! Thanks James.

1 it is then.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2024 Nov 07, 2024

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 07, 2024 Nov 07, 2024

So this is what IngramSpark rejected the epub for! I've put in a query quoting you - we'll see. Might have to do option 2!Content  validation.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2024 Nov 07, 2024

AFAIK, most of these portals use EPUBcheck as their core validation engine. It baffles me how this degree of variance from a well-defined (if antiquated and cluttered) standard can keep recurring.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 07, 2024 Nov 07, 2024

Wrapping images in a more semantic <figure> tag is the correct way to format them. The issue here is not the <figure> tag but that he is using EPUB 2, not EPUB 3. 

And, for the record, I am involved in pushing the changes to how InDesign exports EPUB. These changes all make for better EPUB all around, including better accessibility. There is not veering away from standards happening at all but rather the opposite: adhering more closely to standards. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 23, 2025 Apr 23, 2025

Laura, I wholehartedly disagree. The issue is not that someone is using ePUB 2 instead of ePUB 3, the issue is that the ePUB 2.01 export from InDesign is invalid.

 

Even though ePUB 2.01 may be deemed obsolete, stating that someone is using the wrong export option is missing the point. InDesign still exports ePUB version 2.01 files, so the ePUB 2.01 files that InDesign exports should also comply completely to the ePUB 2.01 standard and not contain newer tags that are not part of the specification. For example, the "xml:lang" attribute in the <package> tag, the <figure> tag and the "role=doc:cover" attribute in the cover.xhtml, and the <meta property"pagebreakSource"> are simply not a part of the ePUB 2.01 specification and should not be exported as such.  These ePUB 3 elements are causing validators to fail and causing problems for people trying to upload their books.

 

In my opinion there are only two options for InDesign:

1. Offer 2.01 and 3.0 ePUB export options, but make sure both options deliver fully valid ePUB files according to the 2.01 of 3.0 specification (so no ePUB 3 tag in ePUB 2.01 files)

2. Remove the ePUB 2.01 export completely.

 

Why that last option is not a good idea imho: despite the fact that many people are shouting that "one should NEVER use ePUB 2.01 anymore", people stick to that format because some e-readers simply won't render ePUB 3.0 documents correctly, while ePUB 2.01 is widely supported on older e-readers and also on the new ones.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 30, 2025 Apr 30, 2025

I agree, to a point. InDesign has borked the EPUB 2 export, no question about it. And that needs to be fixed. That said, EPUB 3 has an NCX and the architecture to make it backward compatible for reading systems that can't be arsed to update. A well-made EPUB 3 works on an EPUB 2 reader that is stuck in the past.

Happy to hear about specific iterations where this is the case so that I can advocate for fixes, if that helps. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2025 Apr 30, 2025

Thank you, Laura

 

Having a correct ePUB 2.01 without having to manually correct the generated ePUB would be really nice.

I can make it very specific for ePUB 2.01:

1. the "xml:lang" attribute in the <package> tag should be removed in content.opf

2. <meta property"pagebreakSource"> should be removed from content.opf, even if a pagebreakSource is defined in the export dialog

3. the <figure> tag should be a <div> in cover.xhtml

4. "role=doc:cover" should be removed from the <image> tag in cover.xhtml

5. in css files: "application/x-font-ttf" should be "font/ttf" (ePUB 2.01 and ePUB 3)

6. in css files: "application/x-font-otf" should be "font/otf" (ePUB 2.01 and ePUB 3)

 

And a generic improvement for ePUB export:

All fonts are exported with color attributes in the CSS (default black). When a reader then switches to night mode on their e-reader the font is black on a black background and therefore unreadable. It would be nice to have an option to not export font colors to the CSS.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 30, 2025 Apr 30, 2025
LATEST

@ArjenBroeze

 

Do you work on Windows or Mac? 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 07, 2024 Nov 07, 2024

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 07, 2024 Nov 07, 2024

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 07, 2024 Nov 07, 2024

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2024 Nov 07, 2024

As LB said, the reflowable export menu gives you a choice of v2.01 or v3; IMHO, the v2 option should just be removed but at least they finally made v3 the default option. (It's the only option for fixed-page, but then, FXL shouldn't be used at all for most projects in InDesign.)

 

It's possible you were misled by the titantic amount of outdated and simply wrong information the web contains on EPUB. That which isn't outdated because it was written and posted ten years ago is that because someone with outdated notions reprinted or copied it. And, of course, this old information is what comes up high in the search returns, masking all newer and more accurate material. (Then again, the collective expertise over in the three-letter portal insist, to this day and the point of tribal warfare, that EPUB 2 is "better," EPUB 3 is completely obsolete, and that their service "doesn't even accept EPUB 3 files any more." So it's kind of a sisyphean task.) The bottom line is that I don't recommend anyone use any web resource  found via search for EPUB information, whether it's a blog or YT video or what, simply because you have to have a high level of expertise to determine if the information is in any way current, valid, useful or even basically right.

 

But now you know to use EPUB 3, at least. 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 08, 2024 Nov 08, 2024

There you go - thank you. EPUB3 it is from now on - I was mislead by 2 being the default and some vague memory of advice to avoid 3!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 08, 2024 Nov 08, 2024

Wonderful. That's an easy fix and makes a better ebook to boot!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines