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