[XML-SIG] Sequential SAX2 Filters?

Uche Ogbuji Uche.Ogbuji at fourthought.com
Thu Apr 14 03:54:26 CEST 2005

On Tue, 2005-04-12 at 22:37 -0500, J. Lujan wrote:
> OK I am relatively new to python and I know this is kind of a general 
> python question but I haven't found an answer any where else. I know you 
> can chain filters by calling nextfilter.startElement(..) and so on. But 
> what if you want sequential filters to modify information that might 
> have been added to the document by a previous filter? I assume you need 
> to parse for each filter but it doesn't matter. What I cannot figure out 
> is how to get the results of the parse into a string that I can pass on 
> to a second parse with a different filter. I hope I am being clear 
> enough here. I want to parse a file and have the result put into a 
> string that I can parse a second time using a different filter. Any 
> suggestions?

If I understand you, you may want to use some variation on
xml.sax.XMLGenerator you might find the following useful:


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