LIT Input: Workaround LIT files generated by some broken software that sets the OPF namespace to http://openebook.org/namespaces/oeb-package/1.0. Fixes #8875 (OEBError: Invalid namespace, when opening LIT eBook in Ebookreader from Calibre)

This commit is contained in:
Kovid Goyal 2011-02-08 16:21:18 -07:00
parent b57ae20862
commit f461783a37

View File

@ -103,6 +103,8 @@ class OEBReader(object):
data = self.oeb.container.read(None) data = self.oeb.container.read(None)
data = self.oeb.decode(data) data = self.oeb.decode(data)
data = XMLDECL_RE.sub('', data) data = XMLDECL_RE.sub('', data)
data = data.replace('http://openebook.org/namespaces/oeb-package/1.0',
OPF1_NS)
try: try:
opf = etree.fromstring(data) opf = etree.fromstring(data)
except etree.XMLSyntaxError: except etree.XMLSyntaxError: