from xml.dom import minidom xmldoc = minidom.parse('binary.xml') print xmldoc grammarNode = xmldoc.firstChild print grammarNode.toxml()