My requirement is to compare the XML files of huge data (previous day Xml Vs Todays Xml file generated)
This code compares the xml files at node level and throws entire node data if differences are found ,but I have huge data under each node,can we do comparison through data level and throw the differences of data which is different in the files.
Set xmlDoc1 = CreateObject("Msxml2.DOMDocument")
xmlDoc1.load("yesterday file.xml ")
Set xmlDoc2 = CreateObject("Msxml2.DOMDocument")
Set ElemList1= xmlDoc1.DocumentElement.ChildNodes
Set ElemList2= xmlDoc2.DocumentElement.ChildNodes
If ElemList1.length=ElemList2.length Then
For i = 0 to ElemList1.length-1
If ElemList1.item(i).Text=ElemList2.item(i).Text Then
Msgbox "child element:"&i &" is same in both XML files"
msgbox "child element:"& i &" is not same in both XML files, In XML file 1, The value is:"&ElemList1.item(i).Text &" and In XML file 1, The value 'is:"&ElemList2.item(i).Text
I recommend you do what AnemUday suggested, and use the QTP XML Compare to get a basic pass/fail result (and a diff file). Then you can walk through the diff file and compare the content of every node in the diff file to the corresponding node in your expected results file. That should let you compare content.
Basically, the QTP XML Compare will give you the data set for your second comparison.
I'd throw together some example code but life is hectic right now. Can anyone else help out?