Is there any way to pass arguments to a SAX parser. I got the parser in as follows:
from xml.sax import make_parser, handler
class parserSAXHandler(handler.ContentHandler):
def __init__(self):
def startElement(self, name, attrs):
def endElement(self,name):
def characters(self, content):
parser = make_parser()
parser.setContentHandler(parserSAXHandler())
doc="PathToDocToBeParsed";
parser.parse(doc);
how can I pass an argument to the handler object?
Simply make your
__init__function take arguments, and store those arguments until later.