Seeking Validation … for My Kobo EPUB File

kobo_logoAfter listening to The Self Publishing Podcast for the last six months, I decided to drop my involvement in KDP Select and begin offering my ebook through multiple online outlets.
From the words of praise that the podcast gave to Kobo, both for their support of indie authors and the ease of use of their backend system, I opted for Kobo as my first foray into self-publishing on a platform other than the 900-lb publishing gorilla that is
While there are a number of sites that will take your .mobi, .epub, .doc, or .pdf and both format it and publish it for you on these alternative self-publishing platforms, I opted to do it myself for the sheer sake of the knowledge gained by going through the process. I considered BookBaby, and many self-publishers use Smashwords, but even those sites have certain issues to take into account when using them. For instance, depending on what option you choose with BookBaby, you’ll be giving up a percentage of sales for each book sold.
Even though I knew I’d likely be frustrated by the time-consuming process of uploading my ebook to various sites, I wanted to know how these sites compare to Amazon. I’ve only uploaded my book to Amazon, Kobo, and Nook, and the process has been painless … for the most part.
As with most issues in life, laying a sure foundation can save you from a number of future headaches. When it comes to self-publishing, your sure foundation is a well-formed, properly formatted file.
This was my major problem when uploading to Kobo.

Note that this issue wasn’t Kobo’s fault. It was entirely my own. They needed a clean, validated EPUB file before accepting my book, so it was on me to provide the right file. Using the same Scrivener project in which I compiled the mobi version of my Kindle ebook, I compiled to the EPUB format. I thought that was all I needed to do.
I thought wrong.
After completing the short amount of basic information that Kobo requested about my book, I uploaded my EPUB file, cautiously optimistic that I’d be able to have the Kobo version online in the same day.

Your File Could Not Be Uploaded

My dreams of easy DIY were dashed with that simple error message. Unfortunately, Kobo didn’t relate why my file couldn’t be uploaded. After a quick search, I discovered the online EPUB Validator from the International Digital Publishing Forum. It’s not much to look at, but it serves an invaluable purpose. By uploading your EPUB file to that site, you’ll be presented with a list of specific problems with your EPUB file.
Here are the actual errors from my EPUB file. Click the image to enlarge it.
EPUB Validator  beta  Results
I uploaded my book and was presented with 35 errors, many of which were similar. While this helped me solve why my EPUB file wasn’t being accepted by Kobo, the errors that the online EPUB Validator displays might as well be written in an alien language. I know enough code to be dangerous, but a typical self-publisher may be daunted by the errors they see.
If there’s one thing I’ve learned about self-publishers, they don’t give up.
[Tweet “Determination to see a job through to completion is a hallmark of an indie author.”]
I wasn’t going to let these 35 errors defeat me, so I searched for more help.

How to View Individual Files in an EPUB

I discovered that an EPUB file is essentially a special type of zip file. In other words, it’s a compressed file format that can be “unzipped,” revealing its multiple documents within. For instance, in regards to the errors I received, I had no idea how to edit OPS/body7.xhtml. How could I edit that single file when it was hidden from me within the EPUB file?
I eventually stumbled upon ePub Zip/Unzip (download link), a Mac-only AppleScript application that does two things and does them well. After installing the program and using it to unzip my EPUB file, I could now view and edit my EPUB’s separate files.
Here’s what the unzipped EPUB file structure looks like. You’ll notice that I can now easily locate OPS/body7.xhtml.
epub file structure

How to Edit EPUB files

I opened the problematic xhtml files in Komodo Edit, a free code editor for Mac, Windows, and Linux.
The EPUB Validator provides you with the Line and Position numbers of the error, i.e. my first error occurred on Line 69, Position 17. In my instance of Komodo Edit, the line numbers weren’t turned on by default, so I selected “View” in the top menu and then “View Line Numbers.” The line numbers appeared on the left side of the page. I scrolled down to Line 69 and used my cursor until the status bar at the very bottom of the application showed me column number 17 (equal to the Position number). Once there, I could finally understand the error message I’d received.
As you can tell, a majority of my issues involved paragraph (<p>) and list (<li>) tags. When looking at the code, I could easily see that I had misplaced <p> tags within a list I’d created. Since it happened multiple times within the same list, that’s why I had 31 similar errors. I also had two unclosed <ul> tags and two more list item (<li>) issues in my voluminous footnotes section.
Once I fixed all of those problems, either through deletion or ensuring that open tags had their proper closing tags, I used ePub Zip/Unzip to zip all of those files back into the EPUB format, resulting in one single file containing all of the folders I’d just unzipped and edited.

I uploaded that EPUB file to the EPUB validator and received what I’d been looking for for so long: validation.

Lastly, I uploaded my freshly validated EPUB file to Kobo and was greeted with a warm welcome message of success. Though it took me longer than I anticipated, I was thrilled to have figured out the issues.
Now The Gospel According to Breaking Bad is available on Kobo thanks to the EPUB Validator, ePub Zip/Unzip, and Komodo Edit.

Have you had problems with EPUB files?