I've been looking around, and though there are several options, none of them really fit my current problem.
I get two XML strings, str1 and str2 that have "User" nodes with childnodes detailing things like name, age, address, etc. From there I need to create a third XML File3 that exclusively contains the fields that have changed between the two while keeping the "name" node to identify that the change was done with that user.
str1:
<users>
<user>
<name>Marco</name>
<height>1,76</height>
<address>C:/ Far-away 34</address>
<mail>marco@marco</mail>
</user>
</users>
str2:
<users>
<user>
<name>Marco</name>
<height>1,80</height>
<address>C:/ Far-away 34</address>
<mail></mail>
</user>
</users>
It should spit out an XML with:
str3:
<users>
<user>
<name>Marco</name>
<height>1,80</height>
<mail></mail>
</user>
</users>
With one of my main complications being that I am not told which nodes will be present (or whether or not they have childnodes) other than "name". May I know, how can we do that Python without installing any pip package?.
You can use ElementTree for this. Parse both XML strings into ElementTree objects, use iter() to iterate over the user elements in both, and compare the text of each element: