Search code examples
pythonxmlminidom

Getting the XML without the <?xml ...?> from minidom


I've used minidom to create an XML and it comes out correctly but I need it to be returned without the <?xml version="1.0" encoding="utf-8"?> at the beginning. Is there a way to get the XML without the <?xml?> tag?


Solution

  • Personally i just slice off the first 22 Chars

    xml_out = doc.toxml()
    return xml_out[22:]