Qtp compare two xml files

1,458 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,458
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Qtp compare two xml files

  1. 1. Fore more QTP Realtime scripts, visit www.ramupalanki.comDim description, filepathSet xmlDoc1 = CreateObject(“Msxml2.DOMDocument”)xmlDoc1.load(“C:Documents and Settingsmohan.kakarlaDesktop1.xml”)’file 1Set xmlDoc2 = CreateObject(“Msxml2.DOMDocument”)xmlDoc2.load(“C:Documents and Settingsmohan.kakarlaDesktop2.xml”)’file 2Set ElemList1= xmlDoc1.DocumentElement.ChildNodesSet ElemList2= xmlDoc2.DocumentElement.ChildNodesIf ElemList1.length=ElemList2.length Then’ check weather both xml file has samenumber of childnodesmsgbox “Both XML files have same number of Child nodes”For i = 0 to ElemList1.length-1If ElemList1.item(i).Text=ElemList2.item(i).Text Thenmsgbox “child element:”&i &” is same in both XML files”Elsemsgbox “child element:”& i &” is not same in both XML files, In XML file 1, Thevalueis:”&ElemList1.item(i).Text &” and In XML file 1, The valueis:”&ElemList2.item(i).TextEnd IfNext

×