Wednesday, December 2, 2009

Working With XMLUtil Object using QTP

The below mentioned code is developed for Working With XMLUtil Object using QTP

'Create a XMLUtil Object
Set xmlUtilObj = XMLUtil.CreateXML

'Load a XML file using XMLUtil Object
xmlUtilObj.LoadFile "c:\plant_catalogue.xml"

msgbox xmlUtilObj.GetRootElement()

' Get the Child elements of XML File
Set xmlChildList = xmlUtilObj.ChildElementsByPath( "/CATALOG/PLANT/COMMON")

' Traverse through the XML File to read ans display the contents
For i = 1 to xmlChildList.count
print xmlChildList.item(i).value
Next

'Destroy the XMLUtil Object
Set xmlUtilObj = Nothing


download plant_catalog.xml from W3Schools

No comments:

Post a Comment