Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-26-2012, 07:37 AM   #1
Man Eating Duck
Addict
Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.
 
Posts: 254
Karma: 69786
Join Date: May 2006
Location: Oslo, Norway
Device: Kobo Aura, Sony PRS-650
Bug in epub metadata writer? Invalid attribute role="aut"

After saving to disk, or using kiwidude's Modify epub plugin with update metadata, I get the error 'The "role" attribute is not an allowed attribute of the <creator> element.' when validating (FC and epubcheck). This is the offending line in content.opf:
Code:
    <dc:creator xmlns:ns1="http://www.idpf.org/2007/opf" ns1:file-as="Last, First" role="aut">Last, First</dc:creator>
Prior to updating metadata the file had an empty creator tag. Changing the offending attribute to ns1:role="aut" (specifying namespace?) fixes the problem.

In a fresh install of calibre portable I observe the same error when saving to disk. Am I doing something strange, or did I stumble upon a calibre bug?

The attached file will reproduce the problem (for me) if added to an empty library and then saved to disk.
Attached Files
File Type: epub Testbook_role_auth.epub (39.6 KB, 298 views)

Last edited by Man Eating Duck; 09-26-2012 at 07:45 AM. Reason: Added example file
Man Eating Duck is offline   Reply With Quote
Old 09-26-2012, 08:32 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That's a bug in XML. XML has no clear rules for how to interpret attributes with no namespace prefix. The spec says that default namespaces apply only to element names and not attribute names and that attribute names should be interpreted in the element namespace. But it also says that attribute with no prefix should be in the null namespace. So different XML tools deal with unprefixed attribute names differently. The XML library calibre uses treats unprefixed attributes to be in the default namespace, which means that there is no need to use opf:role, since opf is the default namespace already. Whatever XML library FC and epubcheck use makes a different assumption about how to interpret unprefixed namespaces, leading to the validation error. In practice, this validation error is meaningless, since tools that actually consume OPF either completely ignore the role attribute or handle both opf:role and role.
kovidgoyal is online now   Reply With Quote
Advert
Old 09-26-2012, 08:59 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I added a workaround that tricks lxml into producing a prefixed role attribute, so that I dont have to deal with bug reports about this in the future.
kovidgoyal is online now   Reply With Quote
Old 09-26-2012, 09:55 AM   #4
Man Eating Duck
Addict
Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.Man Eating Duck juggles neatly with hedgehogs.
 
Posts: 254
Karma: 69786
Join Date: May 2006
Location: Oslo, Norway
Device: Kobo Aura, Sony PRS-650
Sorry, it was not my intention to nag you... my workaround was no effort in any case.

I updated my source tree, and it works as expected now. Thanks a lot!
Man Eating Duck is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug in Kobo processing of epub files causing hang in "Processing content" BensonBear Kobo Reader 21 12-21-2012 05:47 AM
Changing internal ePub title with "Edit metadata" therealjoeblow Conversion 3 11-03-2011 12:01 AM
Value of Attribute "Class" is Invalid Error TFaire ePub 2 09-23-2011 11:25 AM
Bug? "Insert metadata as page at start of book" doesnt encode Comments field properly rollercoaster Calibre 2 04-24-2010 10:40 PM
Error message : "Invalid Format" " Do you want to format your internal memory" narbeauchamp Sony Reader 11 07-22-2009 12:39 PM


All times are GMT -4. The time now is 03:51 AM.


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