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


Python pyexpat.error方法代码示例

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


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

示例1: _flush

# 需要导入模块: import pyexpat [as 别名]
# 或者: from pyexpat import error [as 别名]
def _flush(self):
        if self._data:
            if self._last is not None:
                text = "".join(self._data)
                if self._tail:
                    assert self._last.tail is None, "internal error (tail)"
                    self._last.tail = text
                else:
                    assert self._last.text is None, "internal error (text)"
                    self._last.text = text
            self._data = []

    ##
    # Adds text to the current element.
    #
    # @param data A string.  This should be either an 8-bit string
    #    containing ASCII text, or a Unicode string. 
开发者ID:war-and-code,项目名称:jawfish,代码行数:19,代码来源:ElementTree.py

示例2: __init__

# 需要导入模块: import pyexpat [as 别名]
# 或者: from pyexpat import error [as 别名]
def __init__(self):
        import pyexpat
        self.DocumentStartEvent = None
        self.ElementEvent = None
        self.DocumentEndEvent = None
        self.error = pyexpat.error
        self.parser = pyexpat.ParserCreate("UTF-8", " ")
        self.parser.StartElementHandler = self._onStartElement
        self.parser.EndElementHandler = self._onEndElement
        self.parser.CharacterDataHandler = self._onCdata
        self.parser.StartNamespaceDeclHandler = self._onStartNamespace
        self.parser.EndNamespaceDeclHandler = self._onEndNamespace
        self.currElem = None
        self.defaultNsStack = ['']
        self.documentStarted = 0
        self.localPrefixes = {} 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:18,代码来源:domish.py

示例3: __init__

# 需要导入模块: import pyexpat [as 别名]
# 或者: from pyexpat import error [as 别名]
def __init__(self):
        import pyexpat
        self.DocumentStartEvent = None
        self.ElementEvent = None
        self.DocumentEndEvent = None
        self.error = pyexpat.error
        self.parser = pyexpat.ParserCreate("UTF-8", " ")
        self.parser.StartElementHandler = self._onStartElement
        self.parser.EndElementHandler = self._onEndElement
        self.parser.CharacterDataHandler = self._onCdata
        self.parser.StartNamespaceDeclHandler = self._onStartNamespace
        self.parser.EndNamespaceDeclHandler = self._onEndNamespace
        self.currElem = None
        self.defaultNsStack = ['']
        self.documentStarted = 0        
        self.localPrefixes = {} 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:18,代码来源:domish.py

示例4: parse

# 需要导入模块: import pyexpat [as 别名]
# 或者: from pyexpat import error [as 别名]
def parse(self, buffer):
        try:
            self.parser.Parse(buffer)
        except self.error as e:
            raise ParserError(str(e)) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:7,代码来源:domish.py

示例5: _flush

# 需要导入模块: import pyexpat [as 别名]
# 或者: from pyexpat import error [as 别名]
def _flush(self):
        if self._data:
            if self._last is not None:
                text = "".join(self._data)
                if self._tail:
                    assert self._last.tail is None, "internal error (tail)"
                    self._last.tail = text
                else:
                    assert self._last.text is None, "internal error (text)"
                    self._last.text = text
            self._data = [] 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:13,代码来源:ElementTree.py

示例6: __init__

# 需要导入模块: import pyexpat [as 别名]
# 或者: from pyexpat import error [as 别名]
def __init__(self, html=0, target=None, encoding=None):
        try:
            from xml.parsers import expat
        except ImportError:
            try:
                import pyexpat as expat
            except ImportError:
                raise ImportError(
                    "No module named expat; use SimpleXMLTreeBuilder instead"
                    )
        parser = expat.ParserCreate(encoding, "}")
        if target is None:
            target = TreeBuilder()
        # underscored names are provided for compatibility only
        self.parser = self._parser = parser
        self.target = self._target = target
        self._error = expat.error
        self._names = {} # name memo cache
        # main callbacks
        parser.DefaultHandlerExpand = self._default
        if hasattr(target, 'start'):
            parser.StartElementHandler = self._start
        if hasattr(target, 'end'):
            parser.EndElementHandler = self._end
        if hasattr(target, 'data'):
            parser.CharacterDataHandler = target.data
        # miscellaneous callbacks
        if hasattr(target, 'comment'):
            parser.CommentHandler = target.comment
        if hasattr(target, 'pi'):
            parser.ProcessingInstructionHandler = target.pi
        # Configure pyexpat: buffering, new-style attribute handling.
        parser.buffer_text = 1
        parser.ordered_attributes = 1
        parser.specified_attributes = 1
        self._doctype = None
        self.entity = {}
        try:
            self.version = "Expat %d.%d.%d" % expat.version_info
        except AttributeError:
            pass # unknown 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:43,代码来源:ElementTree.py

示例7: parse

# 需要导入模块: import pyexpat [as 别名]
# 或者: from pyexpat import error [as 别名]
def parse(self, buffer):
        try:
            self.parser.Parse(buffer)
        except self.error, e:
            raise ParserError, str(e) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:7,代码来源:domish.py


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