SAX parse string to Handler??

Alan Kennedy alanmk at
Mon Nov 8 12:20:51 CET 2004

[Juliano Freitas]
 > here is my pythn code that's handle a xml file:


I think you're better off using the standard sax parsing facilities than 
those inside saxexts, etc.

Try this code

import xml.sax

class swdbHandler(xml.sax.handler.ContentHandler):
     def __init__(self):
         self.flag = 0

     def startElement(self, name, atts):
         if name == "swml":
             print "enter"

     def endElement(self, name):
         if name == "swml":
             print "exit"


xml.sax.parseString(xml_string, swdbHandler())


alan kennedy
email alan:    

More information about the Python-list mailing list