def reset(self): self.rawdata = '' self.stack = [] self.lasttag = '???' self.nomoretags = 0 self.literal = 0 self.lineno = 1 self.parser = sgmlop.XMLParser() self.feed = self.parser.feed self.parser.register(self)
def __init__(self, html=0): try: import sgmlop except ImportError: raise RuntimeError("sgmlop parser not available") self.__builder = ElementTree.TreeBuilder() if html: import htmlentitydefs self.entitydefs.update(htmlentitydefs.entitydefs) self.__parser = sgmlop.XMLParser() self.__parser.register(self)
def __init__(self, target): # setup callbacks self.finish_starttag = target.start self.finish_endtag = target.end self.handle_data = target.data # activate parser self.parser = sgmlop.XMLParser() self.parser.register(self) self.feed = self.parser.feed self.entity = { "amp": "&", "gt": ">", "lt": "<", "apos": "'", "quot": '"' }
def __init__(self, target): self.finish_starttag = target.start self.finish_endtag = target.end self.handle_data = target.data self.handle_xml = target.xml self.parser = sgmlop.XMLParser() self.parser.register(self) self.feed = self.parser.feed self.entity = { "amp": "&", "gt": ">", "lt": "<", "apos": "'", "quot": '"' }
def __init__(self, builder=None): ReParser.__init__(self, builder) self.__parser = sgmlop.XMLParser() self.__parser.register(self)
#