Assuming we have the following xml files:
file1.xml:
<main>
<tag1 name="name1">
<t1>text1</t1>
<t2></t2>
<t3></t3>
<t4></t4>
<t5>text5</t5>
<t6>text6</t6>
</tag1>
</main>
file2.xml:
<main>
<tag1 name="name1">
<t1>text1</t1>
<t2></t2>
<t3></t3>
<t4>text4</t4>
<t5>text5</t5>
<t6>text6</t6>
<t7>text7</t7>
<t8></t8>
</tag1>
</main>
For each tag1 tag with same name attribute in file1 and file2, I want to generate a third file with all tx tags of file1 plus tx tags that are in file2 and are not in file1, and also plus textx content that is on file2 and not on file1 even if corresponding tx tag exists on both. I want to do this using python. Look at file_out.xml below for better understanding
file_out.xml:
<main>
<tag1 name="name1">
<t1>text1</t1>
<t2></t2>
<t3></t3>
<t4>text4</t4>
<t5>text5</t5>
<t6>text6</t6>
<t7>text7</t7>
<t8></t8>
</tag1>
</main>