当前位置: 首页>>代码示例>>Python>>正文


Python xmlreader.IncrementalParser方法代码示例

本文整理汇总了Python中xml.sax.xmlreader.IncrementalParser方法的典型用法代码示例。如果您正苦于以下问题:Python xmlreader.IncrementalParser方法的具体用法?Python xmlreader.IncrementalParser怎么用?Python xmlreader.IncrementalParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml.sax.xmlreader的用法示例。


在下文中一共展示了xmlreader.IncrementalParser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: external_entity_ref

# 需要导入模块: from xml.sax import xmlreader [as 别名]
# 或者: from xml.sax.xmlreader import IncrementalParser [as 别名]
def external_entity_ref(self, context, base, sysid, pubid):
        if not self._external_ges:
            return 1

        source = self._ent_handler.resolveEntity(pubid, sysid)
        source = saxutils.prepare_input_source(source,
                                               self._source.getSystemId() or
                                               "")

        self._entity_stack.append((self._parser, self._source))
        self._parser = self._parser.ExternalEntityParserCreate(context)
        self._source = source

        try:
            xmlreader.IncrementalParser.parse(self, source)
        except:
            return 0  # FIXME: save error info here?

        (self._parser, self._source) = self._entity_stack[-1]
        del self._entity_stack[-1]
        return 1 
开发者ID:war-and-code,项目名称:jawfish,代码行数:23,代码来源:expatreader.py

示例2: __init__

# 需要导入模块: from xml.sax import xmlreader [as 别名]
# 或者: from xml.sax.xmlreader import IncrementalParser [as 别名]
def __init__(self, namespaceHandling=0, bufsize=2**16-20):
        xmlreader.IncrementalParser.__init__(self, bufsize)
        self._source = xmlreader.InputSource()
        self._parser = None
        self._namespaces = namespaceHandling
        self._lex_handler_prop = None
        self._parsing = 0
        self._entity_stack = []
        self._external_ges = 1
        self._interning = None

    # XMLReader methods 
开发者ID:war-and-code,项目名称:jawfish,代码行数:14,代码来源:expatreader.py

示例3: parse

# 需要导入模块: from xml.sax import xmlreader [as 别名]
# 或者: from xml.sax.xmlreader import IncrementalParser [as 别名]
def parse(self, source):
        "Parse an XML document from a URL or an InputSource."
        source = saxutils.prepare_input_source(source)

        self._source = source
        self.reset()
        self._cont_handler.setDocumentLocator(ExpatLocator(self))
        xmlreader.IncrementalParser.parse(self, source) 
开发者ID:war-and-code,项目名称:jawfish,代码行数:10,代码来源:expatreader.py

示例4: setContentHandler

# 需要导入模块: from xml.sax import xmlreader [as 别名]
# 或者: from xml.sax.xmlreader import IncrementalParser [as 别名]
def setContentHandler(self, handler):
        xmlreader.IncrementalParser.setContentHandler(self, handler)
        if self._parsing:
            self._reset_cont_handler() 
开发者ID:war-and-code,项目名称:jawfish,代码行数:6,代码来源:expatreader.py

示例5: setProperty

# 需要导入模块: from xml.sax import xmlreader [as 别名]
# 或者: from xml.sax.xmlreader import IncrementalParser [as 别名]
def setProperty(self, name, value):
        if name == handler.property_lexical_handler:
            self._lex_handler_prop = value
            if self._parsing:
                self._reset_lex_handler_prop()
        elif name == property_interning_dict:
            self._interning = value
        elif name == property_xml_string:
            raise SAXNotSupportedException("Property '%s' cannot be set" %
                                           name)
        else:
            raise SAXNotRecognizedException("Property '%s' not recognized" %
                                            name)

    # IncrementalParser methods 
开发者ID:war-and-code,项目名称:jawfish,代码行数:17,代码来源:expatreader.py

示例6: parse

# 需要导入模块: from xml.sax import xmlreader [as 别名]
# 或者: from xml.sax.xmlreader import IncrementalParser [as 别名]
def parse(self, source):
        "Parse an XML document from a URL or an InputSource."
        source = saxutils.prepare_input_source(source)

        self._source = source
        try:
            self.reset()
            self._cont_handler.setDocumentLocator(ExpatLocator(self))
            xmlreader.IncrementalParser.parse(self, source)
        except:
            # bpo-30264: Close the source on error to not leak resources:
            # xml.sax.parse() doesn't give access to the underlying parser
            # to the caller
            self._close_source()
            raise 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:expatreader.py


注:本文中的xml.sax.xmlreader.IncrementalParser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。