There are many ways to read XML, both with simultaneous (DOM) and one bit per second (SAX). I used SAX or lxml to iteratively read large XML files (e.g. wikipedia dump, which is 6.5GB compressed).
However, after doing some iterative processing (in python using ElementTree) of this XML file, I want to write the (new) XML data to another file.
Are there libraries for iteratively writing XML data? I could create an XML tree and then write it, but this is not possible without using templates. Is there anyway to write an XML tree to an iterative file? One bit at a time?
I know that I could generate the XML itself using print "<%s>" % tag_name, etc., but that seems a bit ... hacky.
source
share