I’m trying to build an xml file using elementtree. The first element of an xml file is a comment something like:
However, I cannot figure out how to add that to the beginning of the file. It seems like have to create the root node first in which case the comment follows the root node so the resulting file is invalid because it is missing the encoding. How do I output that line BEFORE the root node? TIA.