06-06-2021, 11:54 PM | #1 |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
"package" in OPF problem?
Looking at an ePub2 that works fine, but ePubCheck complains:
ERROR(RSC-005): Error while parsing file 'element "package" not allowed here; expected element "opf:package" or "package" (with xmlns="http://openebook.org/namespaces/oeb-package/1.0/")'. Then another error for every line in the OPF like: ERROR(RSC-005): Error while parsing file 'element "dc:creator" not allowed here; expected the element end-tag or text'. I have no clue what this means. The OPF begins: <?xml version="1.0" encoding="utf-8"?> <package version="2.0" unique-identifier="ISBN" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> <metadata> Is this where the problem is? Can anyone suggest how to fix this? ========================================= PS. I replaced with the below, copied from another epub, only keeping the original "unique-identifier="ISBN" This now works, epubcheck has no errors. <?xml version="1.0" encoding="utf-8"?> <package version="2.0" unique-identifier="ISBN" xmlns="http://www.idpf.org/2007/opf"> <metadata xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/"> I notice this has most of the "xmlns" links moved to the metadata tag. Any simple guide to what this is all about? Last edited by AlanHK; 06-07-2021 at 12:52 AM. |
06-07-2021, 02:59 AM | #2 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
I'm no XML expert, but I think that with
Code:
<package version="2.0" unique-identifier="ISBN" xmlns="http://www.idpf.org/2007/opf"> Code:
<package version="2.0" unique-identifier="ISBN" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> |
06-07-2021, 09:05 AM | #3 |
Sigil Developer
Posts: 7,659
Karma: 5433388
Join Date: Nov 2009
Device: many
|
As Jellby stated, your package tag has no namespace defined for it.
Just add: xmlns="http://www.idpf.org/2007/opf" to the other namespaces. That line says that things in the opf namespace do NOT need a prefix. Or do as Jellby suggested and use the opf prefix you did define opf: on both the package and metadata tags manifest, spine, etc, etc. I typically use: xmlns="http://www.idpf.org/2007/opf" on the package tag to say no prefix means that tag is in the opf name space, but then use the remaining namespaces including the opf:, dc:, dcterms:, and tei: terms *only* added to the metadata tag for its children to use. You end up with a much simpler and cleaner opf. Last edited by KevinH; 06-07-2021 at 09:07 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre-generated epub (from .docx) gives "e21027" "multiple opf files" on KindleGen | GhostRider | Conversion | 0 | 12-22-2017 09:06 AM |
iTunes Producer "package.opf" error | MatMu | ePub | 3 | 11-19-2017 07:05 PM |
Fixed Layout Sample ".mobi" file with package(html, css, opf, ncx files). | Sushil | Kindle Fire | 1 | 01-13-2012 07:16 AM |