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