from xml.dom import minidomxmldoc = minidom.parse('emails.xml')cNodes = xmldoc.childNodesprint cNodes[0].toxml()nList = cNodes[1].getElementsByTagName("to")for node in nList: eList = node.getElementsByTagName("addr") for e in eList: print e.toxml()nList = cNodes[1].getElementsByTagName("from")for node in nList: eList = node.getElementsByTagName("addr") for e in eList: print e.toxml()def printNodes (nList, level): for node in nList: print (" ")*level, node.nodeName, node.nodeValue printNodes(node.childNodes, level+1)printNodes(xmldoc.childNodes, 0)
Name (required)
email (will not be published) (required)
Website