Search code examples
htmlxmlepubibooksepub3

Error while parsing the prefix "ibooks" for attribute "ibooks:readaloud"


I am trying to validate the following html:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:epub="http://www.idpf.org/2007/ops" epub:prefix="ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/">
    <head>
        <title>Moby-Dick</title>
        <link rel="stylesheet" href="css/stylesheet.css" type="text/css"/>
        <meta charset="utf-8"/>
        <meta name="viewport" content="width=1024, height=600"/>
    </head>
    <body>
        <p ibooks:readaloud="startstop">Read Aloud</p>
    </body>
</html>

but I'm getting the error:

Validating using EPUB version 3.0.1 rules.
FATAL(RSC-016): ./30/moby-dick-mo.epub/OPS/chapter_001.xhtml(11,41): Fatal Error while parsing file 'The prefix "ibooks" for attribute "ibooks:readaloud" associated with an element type "p" is not bound.'.
ERROR(RSC-005): ./30/moby-dick-mo.epub/OPS/chapter_001.xhtml(-1,-1): Error while parsing file 'The prefix "ibooks" for attribute "ibooks:readaloud" associated with an element type "p" is not bound.'.

What am I doing wrong?


Solution

  • XML namespace prefixes must be declared in order for an XML document to be namespace-well-formed. Your declaration of the ibooks namespace prefix is mangled. To fix it, change

    epub:prefix="ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/"
    

    to

    xmlns:ibooks="http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/"