Sax Handler
Juliano Freitas
jubafre at atlas.ucpel.tche.br
Sat Nov 6 13:17:38 EST 2004
hello!!!
here is my pythn code that's handle a xml file:
=============================================================
from xml.sax import saxutils, saxlib, saxexts, parseString
class swdbHandler(saxlib.DocumentHandler):
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"
parser = saxexts.make_parser()
parser.setDocumentHandler(swdbHandler())
# here
parser.parseFile(open("exemplo.xml"))
=============================================================
i want to parse a "xml string" not a file how can i pass my swdbHandler
to this string?? with parseString? i try but doesnt work?
somebody can help me with this??
Juliano Freitas
More information about the Python-list
mailing list