hello!!!
here is my pythn code that's handle a xml file:
=============== =============== =============== =============== =
from xml.sax import saxutils, saxlib, saxexts, parseString
class swdbHandler(sax lib.DocumentHan dler):
def __init__(self):
self.flag = 0
def startElement(se lf, name, atts):
if name == "swml":
print "enter"
def endElement(self , name):
if name == "swml":
print "exit"
parser = saxexts.make_pa rser()
parser.setDocum entHandler(swdb Handler())
# here
parser.parseFil e(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
here is my pythn code that's handle a xml file:
=============== =============== =============== =============== =
from xml.sax import saxutils, saxlib, saxexts, parseString
class swdbHandler(sax lib.DocumentHan dler):
def __init__(self):
self.flag = 0
def startElement(se lf, name, atts):
if name == "swml":
print "enter"
def endElement(self , name):
if name == "swml":
print "exit"
parser = saxexts.make_pa rser()
parser.setDocum entHandler(swdb Handler())
# here
parser.parseFil e(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
Comment