Using the Python module import xml.etree.ElementTree
, how can I concatenate two files? Assuming each file is written to disk and NOT hard coded in. As an illustration of the Linux environment, cat is being used to print the contents of each of these files.
[<user/path>]$ cat file1.xml
<file>has_content</file>
[<user/path>]$ cat file2.xml
<root>more_content</root>
After each of the files has been opened and concatenated to the first
[<user/path>]$ cat new_file.xml
<new_root><file>has_content</file><root><more_content</root></new_root>
I would like to simply 'merge' these two files together but I have been struggling. All I have been really able to find is about appending to a child or adding a SubElement.