Try the code below to compare two xml files
Alternately this can be done using XMLUtils as well
Code:
Set oXML1 = CreateObject("Msxml2.DOMDocument")
oXML1.load("<<Your first File Path >>")
Set oXML2 = CreateObject("Msxml2.DOMDocument")
oXML2.load("<<Your Second File Path >>")
Set XMLElements1= oXML1.DocumentElement.ChildNodes
Set XMLElements2= oXML2.DocumentElement.ChildNodes
If XMLElements1.length=XMLElements2.length Then
msgbox "Child Nodes - Equal"
For i = 0 to XMLElements1.length-1
If XMLElements1.item(i).Text <> XMLElements2.item(i).Text Then
msgbox "Elements Not same- XML files are not equal "
Exit for
End If
Next
msgbox "Elements same- XML files are equal "
else
msgbox "Child Nodes - Not Equal- XML files are not equal"
End If
Alternately this can be done using XMLUtils as well
Code:
xmlFile1 = "<<Your first File Path >>"
xmlFile2 = "<<Your second File Path >>"
Set oXML1 = XMLUtil.CreateXML()
Set oXML2 = XMLUtil.CreateXML()
oXML1.LoadFile (xmlFile1)
oXML2.LoadFile (xmlFile2)
CompareResult = oXML1.compare(oXML2, ResultsXML)
If CompareResult = 1 THEN
MsgBox "XML files are equal"
Else
MsgBox "XML files are not equal"
END IF
ResultsXML.savefile (“c:\results.xml”)