我递归地遍历XML
中的所有节点:
def verify_elements_children(root):
if root.childNodes:
for node in root.childNodes:
if node.nodeType == node.ELEMENT_NODE:
if node.tagName in config_elements_children[node.parentNode.tagName]:
# print node.toxml()
verify_elements_children(node)
但我不知道如何获取所选的node
的所有属性名?在
您可以简单地访问^{} 属性,这是一个NamedNodeMap,在该属性上可以调用
items
来获取字符串键和值:相关问题 更多 >
编程相关推荐