I asked a similar question at What do I need my (ePub) toc.ncx to have?, but thought to create a different question about what to do for a toc.xhtml file.

The error I am getting when I try to validate my ePub 3.0.1 toc.xhtml is:

ERROR OEBPS/toc.xhtml 3 45 Error while parsing file 'element "html" not allowed anywhere; expected element "ns:ncx" (with xmlns:ns="http://www.daisy.org/z3986/2005/ncx/")'.

All the online examples I've seen, for instance epub3-samples, have HTML tags like any other XHTML 1.1 file. ePub Checker seems not to accept this. The toc.xhtml file I have been testing is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      <meta charset="utf-8" />
      <link rel="stylesheet" type="text/css" href="stylesheet.css"
      <section class="base" id="toc">
         <h1>Unvera Announces New Kool-Aid Line</h1>
         <nav epub:type="toc">
            <h2>Table of Contents</h2>
                <li><a href="letters.xhtml">The Angelic Letters</a></li>
<li><a href="doxology.xhtml">Doxology</a></li>
<li><a href="narnia.xhtml">A Pilgrimage from Narnia</a></li>
<li><a href="apprentice.xhtml">Apprentice gods</a></li>
<li><a href="singularity.xhtml">Singularity</a></li>
<li><a href="providence.xhtml">Amazing Providence</a></li>
<li><a href="spectacles.xhtml">The Spectacles</a></li>
<li><a href="druid.xhtml">Archdruid of Canterbury Visits Orthodox Patriarch</a></li>
<li><a href="plato.xhtml">Plato: The Allegory of the... <em>Flickering Screen?</em></a></li>
<li><a href="monk.xhtml">A Comparison Between the Mere Monk and the Highest Bishop</a></li>
<li><a href="gandhi.xhtml">Farewell to Gandhi: The Saint and the Activist</a></li>
<li><a href="alchemy.xhtml">How Shall I Tell an Alchemist?</a></li>
<li><a href="philaret.xhtml">Akathist to St. Philaret the Merciful</a></li>
<li><a href="silence.xhtml">Silence: Organic Food for the Soul</a></li>
<li><a href="rules-of-engagement.xhtml">Rules of Engagement</a></li>
<li><a href="technonomicon.xhtml">Technonomicon: Technology, Nature, Ascesis</a></li>
<li><a href="steel.xhtml">Within the Steel Orb</a></li>
<li><a href="memoirs.xhtml">An Author's Musing Memoirs: Retrospective Reflections, Retracings, and Retractions</a></li>
<li><a href="pet.xhtml">A Pet Owner's Rules</a></li>
<li><a href="backswing.xhtml">The Damned Backswing</a></li>
<li><a href="physics.xhtml">'Physics'</a></li>
<li><a href="commentary.xhtml">The Commentary</a></li>
<li><a href="decisive.xhtml">Two Decisive Moments</a></li>
<li><a href="exotic.xhtml">Exotic Golden Ages and Restoring Harmony with Nature: Anatomy of a Passion</a></li>
<li><a href="arena.xhtml">The Arena</a></li>
<li><a href="humility-royal-race.xhtml">The Treasure of Humility and the Royal Race</a></li>
<li><a href="money.xhtml">Money</a></li>
<li><a href="luddite.xhtml">The Luddite's Guide to Technology</a></li>
<li><a href="grail.xhtml">The Sign of the Grail</a></li>
<li><a href="best.xhtml">The Best Things in Life Are Free</a></li>
<li><a href="hymn.xhtml">Hymn to the Creator of Heaven and Earth</a></li>
<li><a href="new-face-old-ecumenism.xhtml">Book Review: A New Face on an Old Ecumenism (<em>The Orthodox Dilemma Second Edition : Personal Reflections on Global Pan-Orthodox Christian Conciliar Unity</em>)</a></li>
<li><a href="ecumenism.xhtml">An Open Letter to Catholics on Orthodoxy and Ecumenism</a></li>
<li><a href="pope.xhtml">Pope Makes Historic Ecumenical Bid to Woo Eastern Rite Catholics</a></li>
<li><a href="calvinist.xhtml">An Orthodox Looks at a Calvinist Looking at Orthodoxy</a></li>
<li><a href="stephanos.xhtml">Stephanos</a></li>
<li><a href="gamechanger.xhtml">God the Game Changer</a></li>
<li><a href="father.xhtml">God the Spiritual Father</a></li>
<li><a href="death.xhtml">Death</a></li>
<li><a href="open.xhtml">Open</a></li>
<li><a href="no_rights.xhtml">Do We Have Rights?</a></li>
<li><a href="knights.xhtml">Knights and Ladies</a></li>
<li><a href="women.xhtml">Where Is the Good of Women? Feminism Is Called the Women's Movement. But Is It?</a></li>
<li><a href="naturally-inclusive-language.xhtml"><em>Belabored Inclusive Language</em> and <em>Naturally Inclusive Language</em></a></li>
<li><a href="greek.xhtml">Inclusive Language Greek Manuscript Discovered</a></li>
<li><a href="picture.xhtml">A Strange Picture</a></li>
<li><a href="unashamed.xhtml">Unashamed</a></li>
<li><a href="unman.xhtml">Un-Man's Tales: C.S. Lewis's <em>Perelandra</em>, Fairy Tales, and Feminism</a></li>
<li><a href="avatar.xhtml">Veni, Vidi, Vomi: A Look at 'Do You Want to Date My Avatar?'</a></li>
<li><a href="dark_patterns.xhtml">Dark Patterns / Anti-Patterns and Cultural Context Study of Scriptural Texts: A Case Study in Craig Keener's <em>Paul, Women, and Wives: Marriage and Women's Ministry in the Letters of Paul</em></a></li>
<li><a href="contraception.xhtml">Orthodoxy, Contraception, and Spin Doctoring: A Look at an Influential but Disturbing Article</a></li>
<li><a href="life.xhtml">A Wonderful Life</a></li>
<li><a href="social-antibodies.xhtml">'Social Antibodies' Needed: A Request of Orthodox Clergy</a></li>
<li><a href="desire.xhtml">Desire</a></li>
<li><a href="transcendent.xhtml">The Transcendent God Who Approaches Us Through Our Neighbor</a></li>
<li><a href="author.xhtml">About the Author</a></li>
<li><a href="interview.xhtml">An Interview with the Author</a></li>
<li><a href="negotiation.xhtml">Friendly, Win-Win Negotiation: Interest-Based Negotiation and <em>Getting to Yes</em></a></li>
<li><a href="theory-of-alien-minds.xhtml">Theory of Alien Minds: A UX Copernican Shift</a></li>
<li><a href="seraphim.xhtml">What Makes Me Uneasy about Fr. Seraphim (Rose) and His Followers</a></li>
<li><a href="dastardly-duo.xhtml">Dastardly Duo Considered Harmful: <em>Our Thoughts Determine Our Lives</em> and <em>Wounded By Love</em></a></li>
<li><a href="religion-science.xhtml">'Religion and Science' Is Not Just Intelligent Design vs. Evolution</a></li>
<li><a href="chemistry.xhtml"><em>QUICK!</em> What Is Your Opinion about Chemistry?</a></li>
<li><a href="creation.xhtml">Creation and Holy Orthodoxy: Fundamentalism Is Not Enough</a></li>
<li><a href="evolution.xhtml">Note to Orthodox Evolutionists: Stop Trying to Retroactively <del>Shanghai</del> Recruit the Fathers to Your Camp!</a></li>
<li><a href="meatspace.xhtml">Game Review: Meatspace</a></li>
<li><a href="grinch.xhtml">The Grinch Who Stole Christmas</a></li>
<li><a href="icons.xhtml">Lesser Icons: Reflections on Faith, Icons, and Art</a></li>
<li><a href="and_all_that.xhtml">1054 and All That</a></li>
<li><a href="God.xhtml">Does God Suffer?</a></li>
<li><a href="monasticism.xhtml">Monasticism for Protestants</a></li>
<li><a href="sacrament.xhtml">The Eighth Sacrament</a></li>
<li><a href="dream.xhtml">A Dream of Light</a></li>
<li><a href="evil.xhtml">A Picture of Evil</a></li>
<li><a href="amusement.xhtml">Religion within the Bounds of Amusement</a></li>
<li><a href="refutatio.xhtml">Refutatio Omnium Haeresium</a></li>
<li><a href="grace.xhtml">A Shaft of Grace</a></li>
<li><a href="waste.xhtml">Why This Waste?</a></li>
<li><a href="yonder.xhtml">Yonder</a></li>
<li><a href="sermon.xhtml">The Most Politically Incorrect Sermon in History: A Commentary on the Sermon on the Mount</a></li>
<li><a href="math-thesis.xhtml">Closeness Spaces: Elementary Explorations Into Generalized Metric Spaces, and Ordered Fields Derived From Them</a></li>
<li><a href="ai.xhtml">AI as an Arena for Magical Thinking Among Skeptics</a></li>
<li><a href="augustine.xhtml">Does Augustine Return to the Interpersonal Image of Love as Representing the Trinity, or Does He Abandon This in Favour of the Psychological Image?</a></li>
<li><a href="cultures.xhtml">Espiriticthus: Cultures of a Fantasy World Not Touched by Evil</a></li>
<li><a href="janra.xhtml">Janra Ball: The Headache</a></li>
<li><a href="maximos.xhtml"><em>Profoundly Gifted Magazine</em> Interviews Maximos Planos</a></li>
<li><a href="profoundly-gifted.xhtml">Profoundly Gifted Survival Guide</a></li>
<li><a href="blackbird.xhtml">The Wagon, the Blackbird, and the Saab</a></li>
<li><a href="fast_track.xhtml"><em>Your</em> Fast Track to Becoming a Bishop!</a></li>
<li><a href="msbp.xhtml">Eight-Year-Old Boy Diagnosed With Machiavellian Syndrome By Proxy (MSBP)</a></li>
<li><a href="converts.xhtml">Evangelical Converts Striving to be Orthodox</a></li>
<li><a href="jobs.xhtml">Jobs for Theologians</a></li>
<li><a href="bac.xhtml">The Modern Baccalaureate</a></li>
<li><a href="firestorm.xhtml">Firestorm 2034</a></li>
<li><a href="monastery.xhtml">The Monastery</a></li>
<li><a href="repentance-heavens-best-kept-secret.xhtml">Repentance, Heaven's Best-Kept Secret</a></li>
<li><a href="oops.xhtml">Oops: Could the Western Rite Please Try Again?</a></li>
<li><a href="glimpse.xhtml">A Glimpse Through a Crystal</a></li>
<li><a href="stranger.xhtml">Looking at <em>Stranger in a Strange Land</em> as a Modern Christological Heresy</a></li>
<li><a href="customer.xhtml">An Open Letter From a Customer: I Don't <strong>Want</strong> to Abuse Your Employees and Be Rewarded for Gaming the System</a></li>
<li><a href="orb.xhtml">The Steel Orb</a></li>
<li><a href="treasure.xhtml">Treasure</a></li>
<li><a href="martial-arts.xhtml">Can You Smoke Without Inhaling? Martial Arts and the Orthodox Christian</a></li>
<li><a href="link-prospectors.xhtml">An Open Letter to <strong>Other</strong> Link Prospectors</a></li>
<li><a href="spam.xhtml">An Open Letter to Spam Patrons</a></li>
<li><a href="character-sheet.xhtml">Character Sheet</a></li>
<li><a href="supercomputers.xhtml">Macs are now Super.Computer.s running 'IRIX,' a Super.Computer. OS!</a></li>
<li><a href="voyage.xhtml">The Voyage</a></li>
<li><a href="dictionary.xhtml">Hayward's Unabridged Dictionary</a></li>
<li><a href="watch.xhtml">The Watch</a></li>
<li><a href="disruptive-unbranding.xhtml">A Disruptive Take on (Un-)Branding</a></li>
<li><a href="mindstorm.xhtml">The Mindstorm</a></li>
<li><a href="kool-aid.xhtml">Unvera Announces New Kool-Aid Line</a></li>


Does my toc.xhtml need to be changed? If so, how?


1 Answer 1


If you are not going to use a ncx, my answer is no, you don't need to change this xhtml file at all.

I'm going to guess here. ns:ncx means that you are using a namespace called "ncx." A namespace is like an xml prefix. Somewhere -- maybe on another file -- you are referring to the ncx namespace, and the error is suggesting that you need to identify it within the HTML tag (where you have declared other namespaces (or "xmlns" in this file). Because ncx isn't referenced at all in this file, I assume that it's occurring in another file but showing up as an error for this file. As far as I can tell, this file itself looks completely fine.

I would look in the .opf file and try to remove the reference in the manifest section to the ncx file. (Mine looks like this:

 <manifest> <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>

Just delete that line and see what happens. I assume you are trying to do without the ncx file as I suggested on the other thread?

I would look in the .opf file and try to remove the reference in the manifest section to the ncx file. (Mine looks like this: <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/> Just delete that line and see what happens. I assume you are trying to do without the ncx file as I suggested on the other thread?

Actually in the .opf file there is a whole section of references called <spine toc="ncx">. If you are doing without the ncx I would delete this entire SPINE section as well. As I said, removing all references to the the ncx file in the epub files is something I think would work in theory but I have never actually tried it. The important point is that you are referencing the <nav epub:type="toc"> correctly. This should be sufficient for epub validation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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