Project

General

Profile

« Previous | Next » 

Revision 1760

xml_parse.py: parse_next(): On parser error, advance to next XML document since the rest of the current document is corrupted

View differences:

lib/xml_parse.py
44 44
        # Save in case another exception raised, overwriting sys.exc_info()
45 45
        exc.add_traceback(e)
46 46
        if str(e).startswith('no element found:'): return None # no more docs
47
        else: on_error(e)
47
        else: # parser error, which corrupts the rest of the current document
48
            on_error(e)
49
            streams.consume(stream) # advance to next XML document
48 50

  
49 51
def docs_iter(stream, *args, **kw_args):
50 52
    return iter(lambda: parse_next(stream, *args, **kw_args), None)

Also available in: Unified diff