02-17-2012, 02:48 AM
I have coded in vbscript but the msgbox can be changed to Reporter.ReportEvent without problems.
The following code is being added to your code above:
HTH,
The following code is being added to your code above:
Code:
set odic1 = CreateObject("Scripting.Dictionary")
set odic2 = CreateObject("Scripting.Dictionary")
''// the key will contain the nodename and the value
''// this way we catch a "to Sue" as different from a "to John"
''// if there are still duplicates, might want to make use of the improved dictionary
' http://www.advancedqtp.com/wp-content/uploads/WLW/Animproveddictionaryobject_10D37/Dictionary.VBS
' http://www.advancedqtp.com/2008/06/an-improved-dictionary-object/
''// I have not thought about a book catalog and how to handle where the same author will occur more than once. Increase the key to include the year? Do not know.
For i = 0 to Elem_File_1.length-1
odic1.Add Elem_File_1.item(i).nodeName & ":" & Elem_File_1.item(i).text, 1
odic2.add Elem_File_2.item(i).nodeName&":"&Elem_File_2.item(i).text, 1
next
key1arr = odic1.keys
for j = 0 to uBound(key1Arr)
if NOT(odic2.exists(key1Arr(j))) then
msgbox "This does not exist in Test_2.xml : " & key1arr(j)
Else
odic2(key1arr(j)) = odic2(key1arr(j)) + 1 ' value does exist in Test_2.xml
end if
next
s = ""
key2arr = odic2.keys
for k = 0 to uBound(key2arr)
if odic2(key2arr(k)) = 1 Then
s = s & vbcrlf & key2arr(k) ' this value did not exist in Test_1.xml
End If
next
if s <> "" Then
s = "the following does not exist in Test_1.xml file " & vbcrlf & s
msgbox s
else
msgbox "The two files have the same elements."
End If
HTH,