Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 06-06-2021, 11:54 PM   #1
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
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.
AlanHK is offline   Reply With Quote
Old 06-07-2021, 02:59 AM   #2
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
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">
you have a single namespace (xmlns) and there's no ambiguity, while with
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">
you're specifying 5 namespaces (dcterms, tei, xsi, dc, opf) and you should explicitly indicate which one applies to the element, i.e., <opf:package ...>.
Jellby is offline   Reply With Quote
Old 06-07-2021, 09:05 AM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
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.
KevinH is online now   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 12:42 PM.


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