I have two xml files
XML1
<node>
<name>abc</name>
<age>25</age>
</node>
XML2
<node>
<name>abc</name>
<age>25</age>
</node>
<node>
<name>xyz</name>
<age>27</age>
</node>
I want to compare these two files and add missing nodes from XML2 to XML1. I am using tinyxml in C++.
I am thinking of adding a guid to each node ie
<node id={732C8F52-D3E2-4929-9199-48F8F38EA5D3}>
<name>xyz</name>
<age>27</age>
</node>
Now when I will compare I can loop through nodes in both xml and compare nodes based on id and add the missing nodes into XML1.
Is there any better way to accomplish this?