[XML-SIG] Sequential SAX2 Filters?

Lists lists at dreamcatalyst.com
Thu Apr 14 11:20:11 CEST 2005

Uche Ogbuji wrote:

>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 
>If I understand you, you may want to use some variation on
>xml.sax.XMLGenerator you might find the following useful:
Well, I started off with your example "Tip: SAX filters for flexible 
processing" on IBM's developerworks and have reviewed many of your other 
articles. I under stand how most of it works including XMLGenerator. The 
problem I have is more general, a lack of Python knowledge. When I try 
using XMLGenerator, the result goes to standard output, my questions is 
how to get it to go into a string(variable) within the program that can 
be passed on to a second parser instance. I assume I pass a reference to 
a global variable to the filter. I am  missing how to get XMLGenerator 
to write to that variable. Am I missing something with XMLGenerator? Is 
there a way to get the output from the XMLGenerator instance itself? 
Hopefully I am being more clear this time.

Thank You,
J. Lujan

More information about the XML-SIG mailing list