当前位置: 首页>>代码示例>>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;未经允许,请勿转载。