Comment 7 for bug 1185701

Revision history for this message
Pi Delport (pi-delport) wrote :

Artem: That version will silence all legitimate XMLSyntaxErrors too, though.

yli: That's true, although it's easy to work around that by using a guard instead:

    for (state, elem) in etree.iterparse(f):
        if elem.tag == 'foo':
            [...process...]

        # Work around bug #1185701 by bailing out after the end of the document root.
        if elem.getparent() is None:
            break