[Twisted-web] Efficient parsing of XML Posts

Dominic Fox dominic.fox at gmail.com
Wed Apr 19 11:41:49 CDT 2006


I've been delving into twisted.web, looking at the handling of HTTP
requests by the HTTPChannel and Request classes. Something I'd like to
do is produce a variant for XML processing which starts parsing raw
HTTP message body data into SAX events as soon as it comes in. The
idea is to avoid having to cache the incoming raw data in memory (or a
temp file) and wait for it all to have arrived before parsing it -
instead, we would be handling SAX events generated out of the incoming
stream of XML data immediately. This would basically be an efficiency
tweak for turning around XML messages more quickly and with less of a
memory footprint.

Has anything like this been tried already? Does anyone know of any
good reasons *not* to do it? I'm particularly thinking of web service
calls where a custom parser could parse and validate SOAP RPC messages
directly as they came down the wire, without ever constructing an
intermediate raw data object or XML DOM.


More information about the Twisted-web mailing list