xml_etree_elementtree.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:python-xml 作者: emusical 项目源码 文件源码
def map_node_to_class(self, node):
        if isinstance(node, BaseET.ElementTree):
            return nodes.Document
        elif node.tag == BaseET.ProcessingInstruction:
            return nodes.ProcessingInstruction
        elif node.tag == BaseET.Comment:
            return nodes.Comment
        elif isinstance(node, ETAttribute):
            return nodes.Attribute
        elif isinstance(node, ElementTreeText):
            if node.is_cdata:
                return nodes.CDATA
            else:
                return nodes.Text
        elif self._is_node_an_element(node):
            return nodes.Element
        raise exceptions.Xml4hImplementationBug(
            'Unrecognized type for implementation node: %s' % node)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号