lit-meta shouldn't fail on invalid OPF files, instead it should do its best and trust the XML parser to correct any mistakes.

This commit is contained in:
Kovid Goyal 2008-06-04 21:30:10 -07:00
parent d897f81d2b
commit b57f163056

View File

@ -167,7 +167,7 @@ class UnBinary(object):
self.buf = cStringIO.StringIO() self.buf = cStringIO.StringIO()
self.ampersands = [] self.ampersands = []
self.binary_to_text() self.binary_to_text()
self.raw = self.buf.getvalue().lstrip().decode('utf-8') self.raw = self.buf.getvalue().lstrip().decode('utf-8')
self.escape_ampersands() self.escape_ampersands()
def escape_ampersands(self): def escape_ampersands(self):
@ -267,8 +267,8 @@ class UnBinary(object):
self.buf.write(unicode(tag_name).encode('utf-8')) self.buf.write(unicode(tag_name).encode('utf-8'))
elif flags & FLAG_CLOSING: elif flags & FLAG_CLOSING:
if depth == 0: #if depth == 0:
raise LitReadError('Extra closing tag') # raise LitReadError('Extra closing tag')
self.lingering_space = space_enabled self.lingering_space = space_enabled
return index return index
elif state == 'get attr': elif state == 'get attr':