From QTP HELP:
Example in Supplemental.chm
The following example uses the Compare method to compare the elements, document type declaration, attributes, and #text nodes of two XML documents that are expected to be exact duplicates. The files are copies of an XML file. One copy is created using the Load method, and the other is created using the Clone method. The files are expected to match.
Set doc = XMLUtil.CreateXML()
Set doc1 = xmlutil.CreateXML()
Set doc2 = doc.Clone()
res = doc1.Compare(doc2,resultDoc,micXMLValues+micXMLCDa taSections)
if res = 1 then
msgbox "Documents match :-)"
msgbox "Documents do not match :-("
What you need to do is: analyze this implementation, play with that and make the changes according your task.
jbotash is right, I found if there is a difference between the two files when QTP display the differences its kinda hard to figure out what's going on. Also i found that when comparing expected versus acutal xml files, things like dates of creation might give failures. So i found that by creating a regular expression to find the date tag and value then to replace it into your expected xml file, then do the compare. This method saved me some headaches, only if you don't care about the dates of courses.