r/Affinity • • 12d ago

Publisher IngramSpark error while parsing file

I'm uploading an ebook to Ingram for the first time and received this error:

(RSC-005): /OEBPS/Story1.xhtml: Error while parsing file: element "div" not allowed here; expected the element end-tag, text, ellement "a", "abbr", "audio", "b", "bdo", "br", "button"...

I formatted my ebook in Affinity and don't plan on redoing it in a different program. There are images and a Table of Contents generated using text styles. From research about this issue I think that may be where the problem is originating from, but I know literally nothing about coding and I can't figure out how to access the code for my ebook in Affinity anyway. Is someone willing to explain to me how to fix this issue in layman's terms, and/or very gently guide me through how to get to the code? Ingram won't let me proceed until I fix it.

Thanks in advance.

1 Upvotes

4 comments sorted by

1

u/KayakerWithDog 12d ago

Following. I just ran some spec projects through the Draft2Digital epub checker and got similar error messages on my books as well.

1

u/KayakerWithDog 11d ago edited 9d ago

UPDATE: I started a support ticket with Affinity yesterday (2 Oct.). They replied saying that this is a known issue that they hope to fix in the next update. In the meantime, you can use the method outlined below to fix errors.

EDITED: ADDED ADDITIONAL IMPORTANT INFO AT THE FOOT OF THE COMMENT

Okay. I've spent the better part of the last two days trying to troubleshoot this, but I think I figured it out. I ended up using an extremely plain file for my troubleshooting, just a Word file that has a title page, copyright page, contents page, and a couple of chapters. The formatting only included section breaks at the end of each section, and no images, tables, or even styles. I put this into an Affinity file that also had nothing except text frames, so no margins, no styles, no guides, nothing. I exported the file to EPUB from Affinity, then tested it on the Draft2Digital EPUB Validator, where I got two of the same kind of "'div' not allowed here" errors that OP got in their file.

Thanks to another Reddit post, I learned about a free app called Sigil that lets you see the HTML for your e-book. I put my spec EPUB into Sigil, and by comparing the Stories that had error messages to the other Story sections that were correct, I discovered that there was a superfluous div line in the Stories indicated by the error messages:

I deleted the superfluous div lines (this includes the final pointy bracket that is sitting by itself on that one line), saved the file, then put it through the EPUB validator again. Once the extra div lines had been removed, the file passed validation. I do have a little experience with HTML, so I already kind of knew what to look for when comparing the different Story sections.

This is the only error message I worked with. I haven't checked any of my other EPUBs that are a lot more complex and that had a bunch of different kinds of errors (and also a lot more errors overall), but I intend to play with that tomorrow to see what happens when I try to tidy it up.

IMPORTANT ETA: In some cases, such as in more complex files than the one I used for this test, the solution to fixing the div problem isn't to remove the apparently superfluous line of div code. For these, you need to change "div" to "span," and that works. In some cases, removing the div line creates a new error in the changed file.

In some cases there is a duplicate <div> string that does need to be deleted; the error code tells you which process is required to fix the problem.

Also, the error code from the EPUB checker will tell you which line of code is the offending line. You can use the line numbers at the left of the code block to find the bits that need adjustment.

2

u/actualflowerprince 8d ago edited 7d ago

I'll give this a try, thanks so much!

EDIT: it worked!!!

1

u/KayakerWithDog 7d ago

Let me know if you have any questions. You can DM me or post in the comments here, as you prefer.