I have XML starts with following:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE ispXCF SYSTEM "IspXCF.dtd" >
<ispXCF version="3.7.0">
<Comment></Comment>
<Chain>
<Comm>JTAG</Comm>
<Device>
....
And I am using xml.etree.ElementTree
parser. But this parser deletes the second line starting with <!DOCTYPE
I am using the following arguments in the write
method:
tree.write("data.xml", encoding="utf-8", xml_declaration=True, short_empty_elements=None)
but it only keeps <?xml version='1.0' encoding='utf-8'?>
Is there some way how to not delete <!DOCTYPE
line? Or will I have to use some other XML parser?