5

I have created a toc.ncx file in EPUB3 for backwards compatibility with EPUB2 . I used that file in a DRM-free book (replacing the book's toc.ncx with my own) just to see if the code was okay, but when I try to open it in Adobe Digital Editions it opens up a dialog box with the following message :

Unable to open testing.epub
Errors were encountered in this item

Is it not possible to test my ncx file this way? A partial code for my .ncx (just for a few headings) is below . I am creating a three-tiered list using nested navpoint tags in it. Preface is one big heading. Then there is the next big heading titled 'Heading' with Chapter 1 and 2 as its sub-headings. Chapter 2 then has its sub-sub headings with the nested navpoint tags.

Could anyone please look at it and let me know if its okay?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/"  version="2005-1" xml:lang="en-US">
<head>
<meta name="dtb:uid" content="uid"/>
<meta name="dtb:depth" content="1"/>
<meta name="dtb:totalPageCount" content="0"/>
<meta name="dtb:maxPageNumber" content="0"/>
</head>
<docTitle><text>Book Title</text></docTitle>
<docAuthor><text>Anon, Anon</text></docAuthor>


<navMap>

        <navInfo>
            <text>THE CONTENTS</text>
        </navInfo>

        <navPoint class="preface" id="preface-id" playOrder="1"> 
         <navLabel><text>Preface</text></navLabel> 
         <content src="" /> 
        </navPoint> 

        <navPoint class="bk01" id="bk01-id" playOrder="2"> 
         <navLabel><text>Heading</text></navLabel> 
         <content src="" /> 
              <navPoint class="sect01" id="sect01-id" playOrder="3"> 
               <navLabel><text>Chapter 1 (sub-heading of the above Heading)</text></navLabel> 
               <content src="" /> 

              </navPoint> 

              <navPoint class="sect02" id="sect02-id" playOrder="4"> 
               <navLabel><text>Chapter 2 </text></navLabel> 
               <content src="" /> 

                   <navPoint class="sect02DTL" id="sect02DTL-id" playOrder="5"> 
                  <navLabel><text>sub-heading (of chapter 2 above) </text></navLabel> 
                 <content src="" /> 

                   <navPoint class="sect02One" id="sect02One-id" playOrder="6"> 
                  <navLabel><text>sub-sub heading 1(is a direct link to the story text)</text></navLabel> 
                 <content src="" /> 
                </navPoint> 

                <navPoint class="sect02Two" id="sect02Two-id" playOrder="7"> 
                  <navLabel><text>sub-sub heading 2</text></navLabel> 
                 <content src="" /> 
                </navPoint>

                </navPoint> 

              </navPoint> 





        </navPoint> 



</navMap>

</ncx>

Also, there were a few things I wanted to ask about .ncx files in general that I couldn't find sufficiently explained on the internet.

  1. What's the main function of the meta tags in the .ncx file ? For example the meta tags with Total Page Count and max Page Number, do they serve any role ? Could one potentially do without any of them, what would be their importance.

  2. I noticed a tag named PageList with nested PageTarget and navList tags in the toc.ncx file of one of the EPUB books I was looking at for reference, do these work with Kindle ?

4

Instead of using Adobe DE (which isn't always reliable), you should use the epubcheck validator online on your epub file. http://validator.idpf.org/

You can download a copy of the validator tool on your own machine if you wish.

That will give you more verbose and actionable error messages.

Here are some examples of error messages: https://github.com/IDPF/epubcheck/wiki/Errors (unfortunately this list doesn't seem to be complete or up to date).

My guess based on a cursory reading of your file is that there are no file references here. Here's an example from one of my own files:

   <navPoint id="d0e1652" playOrder="7">
            <navLabel>
                <text>The Silver Link</text>
            </navLabel>
            <content src="silver-link.xhtml"/>
        </navPoint>
        <navPoint id="d0e2128" playOrder="8">
            <navLabel>
                <text>Johnny Kinkaid</text>
            </navLabel>
            <content src="johnny-kinkaid.xhtml"/>

But your .ncx file has an empty reference;

      <content src="" /> 

As for your other questions, let me say that I have never had to worry about toc.ncx file problems before ... mainly because I auto-generate the file from Docbook.

The meta stuff you have is exactly what I have; IIRC, it had to do with accessibility and spoken books.

In my experience, kindlegen almost always produces a working file for kindle if you have given it a valid .epub file.

  • Thanks a lot! The validator is giving me these 2 errors: Mimetype entry missing or not the first in archive + Required META-INF/container.xml resource is missing even though both files are present. What I did was get a DRM-free book, and insert my own TOC.ncx in it, I've inserted an xhtml link (the same 'file.xhtml' for each src at the moment) too. My personal epub isn't completed yet, so I was using this one to check if my structure of the .ncx file was correct so I might not run into problems later after having created a really long ncx file. What do you think could be the problem ? – QPTR Apr 28 '14 at 4:47
  • I found what was going wrong! I was creating the epub simply by zipping the folder, and changing .zip to .epub . Reading up, it seems like this is not the correct way. So downloaded and used a helpful utility known as ePUBPack that I found for zipping into epub. EpubValidator is still giving errors but the resultant epub is running on AdobeDE at least. Gonna go work on the errors now. Thanks for your help so much ! – QPTR Apr 28 '14 at 5:32
  • 1
    I know exactly about the stupid mimetype entry missing error. Apparently, how you do it in Windows is very bizarre. I asked about it 4 years ago and got this response: mobileread.com/forums/… – idiotprogrammer Apr 29 '14 at 3:02
  • 1
    I use 7-zip as my archive manager, and with that I can just use zip -qXr ebook.epub mimetype * to make a file called ebook.epub. – Tom Apr 29 '14 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.