I'm trying to parse a large XML file which is being received from the network in Python.
In order to do that, I get the data and pass it to lxml.etree.iterparse
However, if the XML has yet to fully be sent, like so:
<MyXML>
<MyNode foo="bar">
<MyNode foo="ba
If I run etree.iterparse(f, tag='MyNode').next()
I get an XMLSyntaxError
at whereever it was cut off.
Is there any way I can make it so I can receive the first tag (i.e. the first MyNode) and only get an exception when I reach that part of the document? (To make lxml really 'stream' the contents and not read the whole thing in the beginning).