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


Python dom.EMPTY_PREFIX屬性代碼示例

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


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

示例1: start_element_handler

# 需要導入模塊: from xml import dom [as 別名]
# 或者: from xml.dom import EMPTY_PREFIX [as 別名]
def start_element_handler(self, name, attributes):
        node = self.document.createElement(name)
        _append_child(self.curNode, node)
        self.curNode = node

        if attributes:
            for i in range(0, len(attributes), 2):
                a = minidom.Attr(attributes[i], EMPTY_NAMESPACE,
                                 None, EMPTY_PREFIX)
                value = attributes[i+1]
                a.value = value
                a.ownerDocument = self.document
                _set_attribute_node(node, a)

        if node is not self.document.documentElement:
            self._finish_start_element(node) 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:18,代碼來源:expatbuilder.py

示例2: start_element_handler

# 需要導入模塊: from xml import dom [as 別名]
# 或者: from xml.dom import EMPTY_PREFIX [as 別名]
def start_element_handler(self, name, attributes):
        node = self.document.createElement(name)
        _append_child(self.curNode, node)
        self.curNode = node

        if attributes:
            for i in range(0, len(attributes), 2):
                a = minidom.Attr(attributes[i], EMPTY_NAMESPACE,
                                 None, EMPTY_PREFIX)
                value = attributes[i+1]
                d = a.childNodes[0].__dict__
                d['data'] = d['nodeValue'] = value
                d = a.__dict__
                d['value'] = d['nodeValue'] = value
                d['ownerDocument'] = self.document
                _set_attribute_node(node, a)

        if node is not self.document.documentElement:
            self._finish_start_element(node) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:21,代碼來源:expatbuilder.py

示例3: _parse_ns_name

# 需要導入模塊: from xml import dom [as 別名]
# 或者: from xml.dom import EMPTY_PREFIX [as 別名]
def _parse_ns_name(builder, name):
    assert ' ' in name
    parts = name.split(' ')
    intern = builder._intern_setdefault
    if len(parts) == 3:
        uri, localname, prefix = parts
        prefix = intern(prefix, prefix)
        qname = "%s:%s" % (prefix, localname)
        qname = intern(qname, qname)
        localname = intern(localname, localname)
    elif len(parts) == 2:
        uri, localname = parts
        prefix = EMPTY_PREFIX
        qname = localname = intern(localname, localname)
    else:
        raise ValueError("Unsupported syntax: spaces in URIs not supported: %r" % name)
    return intern(uri, uri), localname, prefix, qname 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:19,代碼來源:expatbuilder.py

示例4: _parse_ns_name

# 需要導入模塊: from xml import dom [as 別名]
# 或者: from xml.dom import EMPTY_PREFIX [as 別名]
def _parse_ns_name(builder, name):
    assert ' ' in name
    parts = name.split(' ')
    intern = builder._intern_setdefault
    if len(parts) == 3:
        uri, localname, prefix = parts
        prefix = intern(prefix, prefix)
        qname = "%s:%s" % (prefix, localname)
        qname = intern(qname, qname)
        localname = intern(localname, localname)
    else:
        uri, localname = parts
        prefix = EMPTY_PREFIX
        qname = localname = intern(localname, localname)
    return intern(uri, uri), localname, prefix, qname 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:17,代碼來源:expatbuilder.py


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