There are plenty of examples in the web on how to create a xml with python. An examples is:
import elementtree.ElementTree as ET
root = ET.Element("root")
doc = ET.SubElement(root, "doc")
field1 = ET.SubElement(doc, "field1")
field1.set("name", "blah")
field1.text = "some value1"
field2 = ET.SubElement(doc, "field2")
field2.set("name", "asdfasd")
field2.text = "some vlaue2"
tree = ET.ElementTree(root)
tree.write("filename.xml")
But this creates a document starting with
<root>
and not with
<?xml version="xxx"?>
How can I add the
<?xml version="xxx"?>
bit to the XML?
Thanks, Carlos.