I have this kind of XML structure (output from the Esprima ASL converted from JSON), it can get even more nested than this (\[code\]ASL.xml\[/code\]):\[code\]<?xml version="1.0" encoding="UTF-8" ?> <program> <type>Program</type> <body> <type>VariableDeclaration</type> <declarations> <type>VariableDeclarator</type> <id> <type>Identifier</type> <name>answer</name> </id> <init> <type>BinaryExpression</type> <operator>*</operator> <left> <type>Literal</type> <value>6</value> </left> <right> <type>Literal</type> <value>7</value> </right> </init> </declarations> <kind>var</kind> </body> </program> \[/code\]Usualy for XML I use the \[code\]for node in\[/code\]root.childNodes` but this works only for the direct children:\[code\]import xml.dom.minidom as mddom = md.parse("ASL.xml")root = dom.documentElementfor node in root.childNodes: if node.nodeType == node.ELEMENT_NODE: print node.tagName,"has value:", node.nodeValue:, "and is child of:",node.parentNode.tagName \[/code\]How can I walk all the elements of the XML regardless how many nested elements are?