Python Forum

Full Version: Adding <!Doctype> to existing xml
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,
Im new to python so bear with me .. I have exisiting xml with element and tags i need to add <!Doctype> element , i tried with element tree , writing file with tree.write(it is overwritting it ). Something sinot working .
xml:
<?xml version="1.0" encoding="UTF-8"?>
-<Profile>
<FILENAME>cell.xml</FILENAME>
-<PROFILE_INCIDENT>
<SOFTWARE_REV> </SOFTWARE_REV>
<HARDWARE_REV>rev</HARDWARE_REV>

desired xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Profile>
-<Profile>
<FILENAME>cell.xml</FILENAME>
-<PROFILE_INCIDENT>
<SOFTWARE_REV> </SOFTWARE_REV>
<HARDWARE_REV>rev</HARDWARE_REV>