Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 07-11-2018, 12:48 AM   #1
Albright
Member
Albright began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
"Exactly one 'toc' nav element must be present"

Hi, folks. I'm working on some code for a client which crates EPUB 3 files. The books are working fine in iBooks and Calibre, but now we're trying to upload the file to Google's book store and getting stuck with the lingering error:

"EPUB/toc.xhtml:2, 203: Error while parsing file 'Exactly one 'toc' nav element must be present'."

But there is most definitely exactly one 'toc' nav element in the TOC file, and it matches the spec in other ways as well, as far as I can tell. I presume there's something different that I'm just not seeing, even after comparing this TOC file with a few others from other EPUB files, but I still can't see it and I'm about to start flipping tables.

Maybe it just needs to be seen with a fresh pair of eyes, so if someone could have a quick look at this and see if they can spot something wrong, I'd greatly appreciate it. It's quite long, but I presume the error lies somewhere near the beginning.

(The code below has been run through "xmllint --format" to make it more readable; the "real" file is a bit messier. But that shouldn't make a difference, right?)

Code:
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en">
  <head>
    <link type="text/css" rel="stylesheet" href="assets/css/epub.css"/>
  </head>
  <body>
    <nav xmlns:epub="epub" epub:type="toc" id="toc">
      <h1>Table of Contents</h1>
      <ol>
        <li id="cover">
          <a href="cover.xhtml">Cover Page</a>
        </li>
        <li id="toc-page">
          <a href="toc.xhtml">Table of Contents</a>
        </li>
        <li id="toc-1">
          <a href="1-version-history.xhtml">1.0 The Basics</a>
          <ol>
            <li id="toc-1-1">
              <a href="1-version-history.xhtml">1.1 Introduction</a>
              <ol>
                <li id="toc-1-1-1">
                  <a href="1-version-history.xhtml" id="toc-1-link">1.1.1 Version History</a>
                </li>
              </ol>
            </li>
          </ol>
        </li>
        <li id="toc-2">
          <a href="2-prologue.xhtml">2.0 Walkthrough</a>
          <ol>
            <li id="toc-2-1">
              <a href="2-prologue.xhtml">2.1 Story Walkthrough</a>
              <ol>
                <li id="toc-2-1-1">
                  <a href="2-prologue.xhtml" id="toc-2-link">2.1.1 Prologue</a>
                </li>
                <li id="toc-2-1-2">
                  <a href="3-elgarthe-village.xhtml" id="toc-3-link">2.1.2 Elgarthe Village</a>
                </li>
                <li id="toc-2-1-3">
                  <a href="4-hush-grove.xhtml" id="toc-4-link">2.1.3 Hush Grove</a>
                </li>
                <li id="toc-2-1-4">
                  <a href="5-moon-ridge.xhtml" id="toc-5-link">2.1.4 Moon Ridge</a>
                </li>
                <li id="toc-2-1-5">
                  <a href="6-ancient-ruins-merhl.xhtml" id="toc-6-link">2.1.5 Ancient Ruins Merhl</a>
                </li>
                <li id="toc-2-1-6">
                  <a href="7-mistral-gorge.xhtml" id="toc-7-link">2.1.6 Mistral Gorge</a>
                </li>
                <li id="toc-2-1-7">
                  <a href="8-imperial-capital-watt.xhtml" id="toc-8-link">2.1.7 Imperial Capital Watt</a>
                </li>
                <li id="toc-2-1-8">
                  <a href="9-maarport.xhtml" id="toc-9-link">2.1.8 Maarport</a>
                </li>
                <li id="toc-2-1-9">
                  <a href="10-ragness-ruins.xhtml" id="toc-10-link">2.1.9 Ragness Ruins</a>
                </li>
                <li id="toc-2-1-10">
                  <a href="11-los-labyrinth.xhtml" id="toc-11-link">2.1.10 Los Labyrinth</a>
                </li>
                <li id="toc-2-1-11">
                  <a href="12-sacred-rahet.xhtml" id="toc-12-link">2.1.11 Sacred Rahet</a>
                </li>
                <li id="toc-2-1-12">
                  <a href="13-imperial-command-base.xhtml" id="toc-13-link">2.1.12 Imperial Command Base</a>
                </li>
                <li id="toc-2-1-13">
                  <a href="14-shipsink.xhtml" id="toc-14-link">2.1.13 Shipsink</a>
                </li>
                <li id="toc-2-1-14">
                  <a href="15-salny-village.xhtml" id="toc-15-link">2.1.14 Salny Village</a>
                </li>
                <li id="toc-2-1-15">
                  <a href="16-sal-garthr.xhtml" id="toc-16-link">2.1.15 Sal Garthr</a>
                </li>
                <li id="toc-2-1-16">
                  <a href="17-scar-top.xhtml" id="toc-17-link">2.1.16 Scar Top</a>
                </li>
                <li id="toc-2-1-17">
                  <a href="18-yugebury.xhtml" id="toc-18-link">2.1.17 Yugebury</a>
                </li>
                <li id="toc-2-1-18">
                  <a href="19-holy-cave.xhtml" id="toc-19-link">2.1.18 Holy Cave</a>
                </li>
                <li id="toc-2-1-19">
                  <a href="20-wyllia.xhtml" id="toc-20-link">2.1.19 Wyllia</a>
                </li>
                <li id="toc-2-1-20">
                  <a href="21-marsh-end.xhtml" id="toc-21-link">2.1.20 Marsh End</a>
                </li>
                <li id="toc-2-1-21">
                  <a href="22-mirror-lake.xhtml" id="toc-22-link">2.1.21 Mirror Lake</a>
                </li>
                <li id="toc-2-1-22">
                  <a href="23-infiltrating-the-palace.xhtml" id="toc-23-link">2.1.22 Infiltrating the Palace</a>
                </li>
                <li id="toc-2-1-23">
                  <a href="24-mind-s-end.xhtml" id="toc-24-link">2.1.23 Mind's End</a>
                </li>
                <li id="toc-2-1-24">
                  <a href="25-escaping-the-capital.xhtml" id="toc-25-link">2.1.24 Escaping the Capital</a>
                </li>
                <li id="toc-2-1-25">
                  <a href="26-dhaka-venu.xhtml" id="toc-26-link">2.1.25 Dhaka Venu</a>
                </li>
                <li id="toc-2-1-26">
                  <a href="27-restoring-the-moon-s-power.xhtml" id="toc-27-link">2.1.26 Restoring the Moon's Power</a>
                </li>
                <li id="toc-2-1-27">
                  <a href="28-royal-capital-marche.xhtml" id="toc-28-link">2.1.27 Royal Capital Marche</a>
                </li>
                <li id="toc-2-1-28">
                  <a href="29-lunar-kiln.xhtml" id="toc-29-link">2.1.28 Lunar Kiln</a>
                </li>
                <li id="toc-2-1-29">
                  <a href="30-dhaka-venu-2.xhtml" id="toc-30-link">2.1.29 Dhaka Venu (2)</a>
                </li>
                <li id="toc-2-1-30">
                  <a href="31-fade-valley.xhtml" id="toc-31-link">2.1.30 Fade Valley</a>
                </li>
                <li id="toc-2-1-31">
                  <a href="32-fade-gorge.xhtml" id="toc-32-link">2.1.31 Fade Gorge</a>
                </li>
                <li id="toc-2-1-32">
                  <a href="33-pale-tower.xhtml" id="toc-33-link">2.1.32 Pale Tower</a>
                </li>
                <li id="toc-2-1-33">
                  <a href="34-fade-ridge.xhtml" id="toc-34-link">2.1.33 Fade Ridge</a>
                </li>
                <li id="toc-2-1-34">
                  <a href="35-return-to-the-real-world.xhtml" id="toc-35-link">2.1.34 Return to the Real World</a>
                </li>
                <li id="toc-2-1-35">
                  <a href="36-sacred-rahet-2.xhtml" id="toc-36-link">2.1.35 Sacred Rahet (2)</a>
                </li>
                <li id="toc-2-1-36">
                  <a href="37-lunar-kiln-2.xhtml" id="toc-37-link">2.1.36 Lunar Kiln (2)</a>
                </li>
                <li id="toc-2-1-37">
                  <a href="38-the-moon.xhtml" id="toc-38-link">2.1.37 The Moon</a>
                </li>
                <li id="toc-2-1-38">
                  <a href="39-post-game-content.xhtml" id="toc-39-link">2.1.38 Post Game Content</a>
                </li>
              </ol>
            </li>
            <li id="toc-2-2">
              <a href="40-kanata-s-sidequest.xhtml">2.2 Character Sidequests</a>
              <ol>
                <li id="toc-2-2-1">
                  <a href="40-kanata-s-sidequest.xhtml" id="toc-40-link">2.2.1 Kanata's Sidequest</a>
                </li>
                <li id="toc-2-2-2">
                  <a href="41-lumina-s-sidequest.xhtml" id="toc-41-link">2.2.2 Lumina's Sidequest</a>
                </li>
                <li id="toc-2-2-3">
                  <a href="42-locke-s-sidequest.xhtml" id="toc-42-link">2.2.3 Locke's Sidequest</a>
                </li>
                <li id="toc-2-2-4">
                  <a href="43-van-s-sidequest.xhtml" id="toc-43-link">2.2.4 Van's Sidequest</a>
                </li>
                <li id="toc-2-2-5">
                  <a href="44-obaro-s-sidequest.xhtml" id="toc-44-link">2.2.5 Obaro's Sidequest</a>
                </li>
                <li id="toc-2-2-6">
                  <a href="45-sherra-s-sidequest.xhtml" id="toc-45-link">2.2.6 Sherra's Sidequest</a>
                </li>
              </ol>
            </li>
            <li id="toc-2-3">
              <a href="46-kanata.xhtml">2.3 Characters</a>
              <ol>
                <li id="toc-2-3-1">
                  <a href="46-kanata.xhtml" id="toc-46-link">2.3.1 Kanata</a>
                </li>
                <li id="toc-2-3-2">
                  <a href="47-lumina.xhtml" id="toc-47-link">2.3.2 Lumina</a>
                </li>
                <li id="toc-2-3-3">
                  <a href="48-locke.xhtml" id="toc-48-link">2.3.3 Locke</a>
                </li>
                <li id="toc-2-3-4">
                  <a href="49-van.xhtml" id="toc-49-link">2.3.4 Van</a>
                </li>
                <li id="toc-2-3-5">
                  <a href="50-obaro.xhtml" id="toc-50-link">2.3.5 Obaro</a>
                </li>
                <li id="toc-2-3-6">
                  <a href="51-sherra.xhtml" id="toc-51-link">2.3.6 Sherra</a>
                </li>
                <li id="toc-2-3-7">
                  <a href="52-dianto.xhtml" id="toc-52-link">2.3.7 Dianto</a>
                </li>
                <li id="toc-2-3-8">
                  <a href="53-galdra.xhtml" id="toc-53-link">2.3.8 Galdra</a>
                </li>
              </ol>
            </li>
          </ol>
        </li>
        <li id="toc-3">
          <a href="54-roadmap.xhtml">3.0 Extras</a>
          <ol>
            <li id="toc-3-1">
              <a href="54-roadmap.xhtml">3.1 Trophy Guide</a>
              <ol>
                <li id="toc-3-1-1">
                  <a href="54-roadmap.xhtml" id="toc-54-link">3.1.1 Roadmap</a>
                </li>
                <li id="toc-3-1-2">
                  <a href="55-trophy-guide-1.xhtml" id="toc-55-link">3.1.2 Trophy Guide (1)</a>
                </li>
                <li id="toc-3-1-3">
                  <a href="56-trophy-guide-2.xhtml" id="toc-56-link">3.1.3 Trophy Guide (2)</a>
                </li>
              </ol>
            </li>
          </ol>
        </li>
      </ol>
    </nav>
  </body>
</html>
Albright is offline   Reply With Quote
Old 07-11-2018, 03:38 AM   #2
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 4,346
Karma: 14300083
Join Date: Dec 2010
Device: Kindle PW2
Most likely the properties="nav" attribute is missing in the <manifest> section of the .opf file.
Double-check the entry for toc.xhtml and add it if it's missing.
Doitsu is offline   Reply With Quote
Old 07-11-2018, 12:31 PM   #3
Albright
Member
Albright began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Quote:
Originally Posted by Doitsu View Post
Most likely the properties="nav" attribute is missing in the <manifest> section of the .opf file.
Double-check the entry for toc.xhtml and add it if it's missing.
Doitsu;

Thanks for the suggestion. Unfortunately, that doesn't seem to be the problem here. Here's the line for the TOC file in the manifest.

Code:
    <item id="toc" href="toc.xhtml" media-type="application/xhtml+xml" properties="nav"/>
Also, both iBooks and Calibre have no problems finding the TOC file and using it to build their respective index menus.
Albright is offline   Reply With Quote
Old 07-11-2018, 01:00 PM   #4
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 4,346
Karma: 14300083
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Albright View Post
Unfortunately, that doesn't seem to be the problem here.
You might want to check your book with the IDPF validator, which might give you a more precise error message than the Google validator:

For example:

Quote:
ERROR (RSC-005) at "book.epub/OEBPS/content.opf" (line XX, col YY): Error while parsing file 'Exactly one manifest item must declare the 'nav' property (number of 'nav' items: 0)'.
No manifest item has a properties="nav" attribute.

Quote:
ERROR (RSC-005) at "book.epub/OEBPS/content.opf" (line XX, col YY): Error while parsing file 'Exactly one manifest item must declare the 'nav' property (number of 'nav' items: 2)'.
Two manifest items have a properties="nav" attribute.

If you don't get any error messages, there might be a problem with the Google validator.
Doitsu is offline   Reply With Quote
Old 07-11-2018, 03:58 PM   #5
Albright
Member
Albright began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Doitsu:

Thanks again for your reply, but again, this is not an issue with the manifest. (Though, as far as I can tell, it's not an issue with the actual TOC, either…)

That IDPF validator is also complaining about "Exactly one 'toc' nav element must be present." It provides the line and character position of… the start of the nav element. Argh.

Starting to wonder if it's parsing the TOC file twice for some reason…
Albright is offline   Reply With Quote
Old 07-11-2018, 05:02 PM   #6
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 4,346
Karma: 14300083
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Albright View Post
That IDPF validator is also complaining about "Exactly one 'toc' nav element must be present."
If you remove the xmlns:epub="epub" attribute the error should go away.

Code:
<nav xmlns:epub="epub" epub:type="toc" id="toc">
Doitsu is offline   Reply With Quote
Old 07-11-2018, 05:57 PM   #7
Albright
Member
Albright began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Holy crap. I didn't think that could possibly be the problem, and that bit was being added by my XML library anyway so I assumed it was correct…*but I tried it anyway using some simple string replacement on the serialized XML, and… it works. That's insane, but it works.

Thank you!
Albright is offline   Reply With Quote
Old 07-13-2018, 08:03 PM   #8
Sarmat89
Groupie
Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.
 
Posts: 153
Karma: 2100000
Join Date: Nov 2015
Device: none
Quote:
Originally Posted by Albright View Post
I didn't think that could possibly be the problem, and that bit was being added by my XML library anyway
The correct namespace for "xmlns:epub" is "http://www.idpf.org/2007/ops". Your value "epub" is bogus, and you should fix it.

Technically, the validator looks for "{http://www.idpf.org/2007/ops}type" attribute, but your XML has "{epub}type" instead.

Last edited by Sarmat89; 07-13-2018 at 08:05 PM.
Sarmat89 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Error while parsing file 'element "img" not allowed here" shotsfromthebar Editor 3 03-31-2017 04:53 AM
Ibooks epub 3 error : exactly one 'toc' nav element must be present Firebrand007 ePub 6 01-02-2015 11:00 PM
The element type "p" must be terminated by the matching end-tag "</p>". uieluck ePub 10 02-12-2013 08:04 PM
Engineering Thesis, "Readability of text in present eBooks readers"" japkooo General Discussions 4 10-26-2012 03:43 PM
Getting calibre to detect "Prologue" and "Epilogue" for TOC sherman Calibre 2 09-20-2010 03:21 AM


All times are GMT -4. The time now is 02:26 PM.


MobileRead.com is a privately owned, operated and funded community.