Error: "file 'element "package" not allowed anywhere"

4 posts / 0 new
Last post

Hi everyone -

When validating my epub I can't get rid of the following errors. It revolves around the unique id for the pub but I can't shake it off. I checked for curly quotation marks etc but this seems not to be the issue:

Error msg 1:
file: OEBPS/content.opf
lines: 2 / 104
Error while parsing file 'element "package" not allowed anywhere; expected element "ns:package" (with xmlns:ns="http://www.idpf.org/2007/opf")'.

Error msg 2:
file: ./tmp/uploads/1460593894128_0000208467/inputFile/re-structure_conference-proceedings.epub/OEBPS/content.opf(-1,-1)
The unique-identifier 'null' was not found.

My content.opf:
<?xml version="1.0" encoding="utf-8"?>
<package unique-identifier="uid" version="3.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<metadata>
<dc:title xmlns:dc="urn:x-prefix:dc">Re-structure Conference Proceedings</dc:title>

My container.xml:

<?xml version="1.0"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="OEBPS/content.opf"
media-type="application/oebps-package+xml" />
</rootfiles>
</container>

Any ideas what I am missing here?

Thanks in advance!
jan

You have the container namespace declared on both your package element and your container element. The namespace for the package element is http://www.idpf.org/2007/opf

In other words, you need to change the xmlns="..." attribute on the package element to the following:

<package ... xmlns="http://www.idpf.org/2007/opf">

The unique identifier error will resolve itself once you do that.

Note that the Dublin Core prefix is being declared incorrectly, too.

You can just declare it once on the metada (or package) element, like this:

<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">

And then strip these invalid local declarations on the DC elements: xmlns:dc="urn:x-prefix:dc"

Thanks, that fixed it. And now I am getting all these other errors ... :)
I'll keep you guys posted. ;)

Secondary menu