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


Python handler.ContentHandler方法代碼示例

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


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

示例1: _qname

# 需要導入模塊: import handler [as 別名]
# 或者: from handler import ContentHandler [as 別名]
def _qname(self, name):
        """Builds a qualified name from a (ns_url, localname) pair"""
        if name[0]:
            # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is
            # bound by definition to http://www.w3.org/XML/1998/namespace.  It
            # does not need to be declared and will not usually be found in
            # self._current_context.
            if 'http://www.w3.org/XML/1998/namespace' == name[0]:
                return 'xml:' + name[1]
            # The name is in a non-empty namespace
            prefix = self._current_context[name[0]]
            if prefix:
                # If it is not the default namespace, prepend the prefix
                return prefix + ":" + name[1]
        # Return the unqualified name
        return name[1]

    # ContentHandler methods 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:20,代碼來源:saxutils.py

示例2: __init__

# 需要導入模塊: import handler [as 別名]
# 或者: from handler import ContentHandler [as 別名]
def __init__(self):
        self._cont_handler = handler.ContentHandler()
        self._dtd_handler = handler.DTDHandler()
        self._ent_handler = handler.EntityResolver()
        self._err_handler = handler.ErrorHandler() 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:7,代碼來源:xmlreader.py

示例3: getContentHandler

# 需要導入模塊: import handler [as 別名]
# 或者: from handler import ContentHandler [as 別名]
def getContentHandler(self):
        "Returns the current ContentHandler."
        return self._cont_handler 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:5,代碼來源:xmlreader.py

示例4: __init__

# 需要導入模塊: import handler [as 別名]
# 或者: from handler import ContentHandler [as 別名]
def __init__(self, out=None, encoding="iso-8859-1"):
        if out is None:
            import sys
            out = sys.stdout
        handler.ContentHandler.__init__(self)
        self._out = out
        self._ns_contexts = [{}] # contains uri -> prefix dicts
        self._current_context = self._ns_contexts[-1]
        self._undeclared_ns_maps = []
        self._encoding = encoding 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:12,代碼來源:saxutils.py

示例5: warning

# 需要導入模塊: import handler [as 別名]
# 或者: from handler import ContentHandler [as 別名]
def warning(self, exception):
        self._err_handler.warning(exception)

    # ContentHandler methods 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:6,代碼來源:saxutils.py

示例6: __init__

# 需要導入模塊: import handler [as 別名]
# 或者: from handler import ContentHandler [as 別名]
def __init__(self, out=None, encoding="iso-8859-1"):
        handler.ContentHandler.__init__(self)
        out = _gettextwriter(out, encoding)
        self._write = out.write
        self._flush = out.flush
        self._ns_contexts = [{}] # contains uri -> prefix dicts
        self._current_context = self._ns_contexts[-1]
        self._undeclared_ns_maps = []
        self._encoding = encoding 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:11,代碼來源:saxutils.py


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