我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用xml.sax.handler()。
def __init__( self, input_file, ContentHandlerClass, ignored_attr_types=None, max_entries=0, ): self._input_file = input_file self._max_entries = max_entries self._ignored_attr_types = {}.fromkeys(map(lower,(ignored_attr_types or []))) self._current_record = None,None self.records_read = 0 self._parser = xml.sax.make_parser() self._parser.setFeature(xml.sax.handler.feature_namespaces,0) content_handler = ContentHandlerClass(self) self._parser.setContentHandler(content_handler)
def reset(self): self.pulldom = PullDOM() # This content handler relies on namespace support self.parser.setFeature(xml.sax.handler.feature_namespaces, 1) self.parser.setContentHandler(self.pulldom)
def create_parser(): """Create and return an AIML parser object.""" parser = xml.sax.make_parser() handler = AimlHandler("UTF-8") parser.setContentHandler(handler) #parser.setFeature(xml.sax.handler.feature_namespaces, True) return parser
def create_parser(): """Create and return an AIML parser object.""" parser = xml.sax.make_parser() handler = AimlHandler("UTF-8") parser.setContentHandler(handler) # parser.setFeature(xml.sax.handler.feature_namespaces, True) return parser
def __init__(self,parser_instance): self._parser_instance = parser_instance xml.sax.handler.ContentHandler.__init__(self)