[XML-SIG] XML processing

Josh English joshua.r.english at gmail.com
Sat Feb 14 20:01:01 CET 2009

I started with DOM processing, but the computer I had back then
couldn't handle XML files larger that 60K or so. (Serious memory
limitations.) So I learned SAX to extract data from my XML, but had to
revert to DOM to put data back in. Since these worked differently, I
ended up creating a DOM element, then passing the XML text back to a
SAX parser. It was ugly, but I got around the file size.

I've replaced everything with ElementTree. I'm on a computer without
memory limitations (well, I haven't tried to parse a file too large
yet), and ElementTree does a good job of extracting information as
well as writing human-readable XML.

I think the ElementTree page has a good tutorial. It's good enough for
me, at least.

The only disadvantage I've run into is my implementation spends a lot
of time parsing and over writing my XML data files, so that overhead
is costly, but the application is small enough, and the network isn't
getting bogged down, so I can get away with it.

I've got some very old examples at this page:

The code isn't well commented, but hey, this is Python  : )

On 2/13/09, Neil Munro <neilmunro at gmail.com> wrote:

Josh English
Joshua.R.English at gmail.com

More information about the XML-SIG mailing list