View Single Post
Old 12-22-2021, 09:09 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: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
OPF header error

Editing an epub2, that works fine except that epubcheck hates the OPF file.

The head of the file:
Code:
<?xml version="1.0" encoding="utf-8"?>
<package version="2.0" unique-identifier="BookId" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <metadata>

This gives epubcheck errors:
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/")'.
ERROR(RSC-005): Error while parsing file 'element "dc:identifier" not allowed here; expected the element end-tag or text'.
-- then a similar error for every single line in the OPF.

The rest of the OPF looks very much the same as any other, so I'm pretty sure the problem is the definitions in the headers.

I have zero understanding of what these header lines do, except perhaps the unique-identifier.

So I took the headers from another epub2, changing only the unique-identifier, pasted that in and now epubcheck is happy.

Code:
<?xml version="1.0" encoding="utf-8"?>
<package version="2.0" unique-identifier="BookId" xmlns="http://www.idpf.org/2007/opf">
  <metadata xmlns:dcterms="http://purl.org/dc/terms/" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/">
Can anyone explain what the actual problem was?
Why do some of the "xmlns" appear in the "package" line, others in the "metadata" tag?

How can these URLS be necessary, since ebooks are readable on devices without internet connection?
AlanHK is offline   Reply With Quote