vbscript - Compare two xml files using VBS in QTP -
i need compare 2 xml files using qtp values each tag needs compared , need print difference in values if found. used built in function xmlutil not working expected i.e.. creates file differences including parent tag.
<tns:aal_request_new xsi:schemalocation="http://www.bnymellon.com/aal_request_new aal_request_new.xsd"> <tns:opf_information> <tns:source> <tns:source>eph</tns:source> </tns:source> <tns:references> <tns:accounting_record_reference>130830000672401</tns:accounting_record_reference> <tns:opf_reference>eph1308300006724</tns:opf_reference> <tns:group_reference>eph1308300006723</tns:group_reference> </tns:references> </tns:opf_information> </tns:aal_request_new>
in above xml file need tags values like
tns:source value eph, tns:accounting_record_reference value 130830000672401, tns:opf_reference value eph1308300006724 , tns:group_reference eph1308300006723 compared , not parent tags tns:references, tns:opf_information or tns:aal_request_new.
can logic fetch tags has no child tag inside , ends having value between start <> , end , compare other file , print tag name , values if there difference?
you can use createobject("microsoft.xmldom") read xml files , retrive tags tag name , comparte them both.
set objxmldoc = createobject("microsoft.xmldom") objxmldoc.async = false objxmldoc.load("<xml path>") set root = objxmldoc.documentelement set tags = root.tagnames set nodelist = root.getelementsbytagname("<node name>") each elem in nodelist msgbox elem.text next
thanks , regards
Comments
Post a Comment