當前位置: 首頁>>代碼示例>>Python>>正文


Python expat.error方法代碼示例

本文整理匯總了Python中xml.parsers.expat.error方法的典型用法代碼示例。如果您正苦於以下問題:Python expat.error方法的具體用法?Python expat.error怎麽用?Python expat.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xml.parsers.expat的用法示例。


在下文中一共展示了expat.error方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _flush

# 需要導入模塊: from xml.parsers import expat [as 別名]
# 或者: from xml.parsers.expat 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: feed

# 需要導入模塊: from xml.parsers import expat [as 別名]
# 或者: from xml.parsers.expat import error [as 別名]
def feed(self, data, isFinal = 0):
        if not self._parsing:
            self.reset()
            self._parsing = 1
            self._cont_handler.startDocument()

        try:
            # The isFinal parameter is internal to the expat reader.
            # If it is set to true, expat will check validity of the entire
            # document. When feeding chunks, they are not normally final -
            # except when invoked from close.
            self._parser.Parse(data, isFinal)
        except expat.error as e:
            exc = SAXParseException(expat.ErrorString(e.code), e, self)
            # FIXME: when to invoke error()?
            self._err_handler.fatalError(exc) 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:18,代碼來源:expatreader.py

示例3: external_entity_ref

# 需要導入模塊: from xml.parsers import expat [as 別名]
# 或者: from xml.parsers.expat import error [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

示例4: _flush

# 需要導入模塊: from xml.parsers import expat [as 別名]
# 或者: from xml.parsers.expat import error [as 別名]
def _flush(self):
        if self._data:
            if self._last is not None:
                text = string.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:rafasashi,項目名稱:razzy-spinner,代碼行數:19,代碼來源:ElementTree.py

示例5: feed

# 需要導入模塊: from xml.parsers import expat [as 別名]
# 或者: from xml.parsers.expat import error [as 別名]
def feed(self, data, isFinal = 0):
        if not self._parsing:
            self.reset()
            self._parsing = 1
            self._cont_handler.startDocument()

        try:
            # The isFinal parameter is internal to the expat reader.
            # If it is set to true, expat will check validity of the entire
            # document. When feeding chunks, they are not normally final -
            # except when invoked from close.
            self._parser.Parse(data, isFinal)
        except expat.error, e:
            exc = SAXParseException(expat.ErrorString(e.code), e, self)
            # FIXME: when to invoke error()?
            self._err_handler.fatalError(exc) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:18,代碼來源:expatreader.py

示例6: _flush

# 需要導入模塊: from xml.parsers import expat [as 別名]
# 或者: from xml.parsers.expat 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:avocado-framework,項目名稱:avocado-vt,代碼行數:19,代碼來源:element_tree.py


注:本文中的xml.parsers.expat.error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。