[XML-SIG] Returning dictionary from endDocument under xml.sax

Martin v. Loewis martin@v.loewis.de
08 May 2002 21:53:32 +0200


Brian Birkinbine <bbirkinbine@earthlink.net> writes:

> I'm having difficulty returning a dictionary from the XML code below.

Notice that parsing with SAX does not "return" anything. Instead, the
SAX XML reader notifies the application (i.e. the ContentHandler)
about a series of events - that's it. More does not happen.

> 	result = xml.sax.parseString(xmlbuffer[counter],xmlhandler)
> 	# I've also tried result.append(xml.sax.parseString ...) and it doesn't work

That's incorrect. You cannot return a valud from parsing. Instead, you
have to collect all data in the content handler, and then query the
concent handler after parsing returns.

HTH,
Martin