![]() |
Adding <!Doctype> to existing xml - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Adding <!Doctype> to existing xml (/thread-9133.html) |
Adding <!Doctype> to existing xml - harshvardhancse - Mar-22-2018 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> |