I have an xml file which looks like the below example
<Ids>
<Id>
<set>ai</set>
<idN>2000</idN>
<Desc>Node</Desc>
<tabs>
<tab>
<tabName>na</tabName>
<tabAlias>na</tabAlias>
<tabQualifier>SCH</tabQualifier>
</tab>
</tabs>
<cls>
<cl>
<cName>def</cName>
<cLName>term</clName>
<clPos>0</clPos>
<tabName>nodeassign</tabName>
<clType>C</clType>
<dName></dName>
<dI>
<dB>0</dB>
<gd>0</gd>
<gdgR></gdgR>
<gCol></gCol>
</dI>
</cl>
<cl>
<cName>default</cName>
<cLName>mux_id</cLName>
<clPos>1</clPos>
<tabName>nodeassign</tabName>
<clType>I</clType>
<dName></dName>
<dI>
<dB>0</dB>
<gd>0</gd>
<gdgR></gdgR>
<gCol></gCol>
</dI>
</cl>
</cls>
</Id>
</Ids>
This is just a part of a large xml file. I have to compare two xml files and should be able to get out all the differences in two files to an separate xml. Should be able to change the values of few elements if they are different from the other xml file.
So to start with this I followed the approached suggested in the following link http://www.daniweb.com/software-development/csharp/threads/46345. But when I have generated a dataset for the given xml, there lots of tables created with in the dataset (like Ids, id, cls, cl, di, tabs…). I did not understand how to establish the relationships between the tables. Also did not understand which column in the generated tables becomes the primary key so that i can rely on it. The example provided in the above link is a simple xml so the author was able to solve the problem easily.
But the xml which I have is bit complex. Any help much appreciated.
Thanks.
I have followed similar solution specified in the given link and was able to solve my problem. But I am still working on it.
When I have created a dataset and loaded my xml, the following relations are created in the dataset and with those I was able to navigate other rows. The relations that were created are as follows:
The sample code for that is as follows:
Even though the approach is inefficient but I have got easy to extend and maintainable code. Any how this code is just for writing a tool for one of my xmls.