configuration_element_class.py 文件源码

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

项目:warriorframework 作者: warriorframework 项目源码 文件源码
def parse_tree(self, node):
        """
            Method to parse ElementTree to ConfigurationElement Tree
        :param node:
        :return:
        """
        for key in node.attrib:
            self.attributes[key] = node.attrib[key]
        self.attributes['xml_tag'] = node.tag
        # self.attributes['xml_element'] = node

        for child in node:
            try:
                if not child.attrib['name'] in self.children:
                    child_config = ConfigurationElement(child.attrib['name'])
                    child_config.parse_data(child, root=False)
                    self.children[child.attrib['name']] = child_config
                else:
                    self.children[child.attrib['name']].parse_tree(child)
            except KeyError:
                print_error("No name attribute for node " + child.tag + ". Tree with root "
                            "at node " + child.tag + " not parsed.")
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号