[XML-SIG] Sequential SAX2 Filters?

Uche Ogbuji uche.ogbuji at fourthought.com
Thu Apr 14 15:18:05 CEST 2005

On Thu, 2005-04-14 at 04:43 -0500, Lists wrote:

> Sorry, I did not review the article you suggested close enough. I 
> reviewed it again and saw that you had understood me and given me a 
> solution. Thank you very much. All of your articles have helped to fill 
> the void in understandable documentation.

Always happy to help, and it's fun to use the time machine :-) .  For
completeness, I'll mention what you might have already discovered.  The
first optional parameter to XMLGenerator is an output buffer, and it can
be a string buffer.  So if instead of, as in listing 1 of the article:

        logger = XMLGenerator(output, encoding)

You do

        import cStringIO #Probably want to import this at the top
        buffer = cStringIO.StringIO()
        logger = XMLGenerator(buffer, encoding)

Then all the output from the generator would be accumulated in buffer,
and you could get it using buffer.getvalue().

Good luck.

Uche Ogbuji                               Fourthought, Inc.
http://uche.ogbuji.net                    http://fourthought.com
http://copia.ogbuji.net                   http://4Suite.org
Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html
Writing and Reading XML with XIST - http://www.xml.com/pub/a/2005/03/16/py-xml.html
Use XSLT to prepare XML for import into OpenOffice Calc - http://www.ibm.com/developerworks/xml/library/x-oocalc/
Schema standardization for top-down semantic transparency - http://www-128.ibm.com/developerworks/xml/library/x-think31.html

More information about the XML-SIG mailing list