XML header getting removed after processing with elementtree
问题 i have an xml file and i used Elementtree to add a new tag to the xml file.My xml file before processing is as follows <?xml version="1.0" encoding="utf-8"?> <PackageInfo xmlns="http://someurlpackage"> <data ID="http://someurldata1">data1</data > <data ID="http://someurldata2">data2</data > <data ID="http://someurldata3">data3</data > </PackageInfo> I used following python code to add a new data tag and write it to my xml file tree = ET.ElementTree(xmlFile) root = tree.getroot() elem= ET