from xml.dom import minidom xmldoc = minidom.parse('binary.xml') print xmldoc grammarNode = xmldoc.firstChild print grammarNode.childNodes print grammarNode.firstChild.toxml() print grammarNode.childNodes[1].toxml() print grammarNode.childNodes[3].toxml() print grammarNode.lastChild.toxml()