Wednesday, December 2, 2009

Working With DotNetFactory Object using QTP


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

'Creating a DotNetFactory object pointing to a XML File
Set xmlDNFObj = DotNetFactory.CreateInstance("System.Xml.XPath.XPathDocument",, "c:\plant_catalogue.xml")

'Reading the nodes of the XML file into a list object
set xmlDNFNodes = xmlDNFObj.CreateNavigator.select( "/CATALOG/PLANT/COMMON")

'Traversing through the list of objects and displaying the values
Do While xmlDNFNodes.MoveNext

print xmlDNFNodes.current.value




loop

'Destroying the list of DotNetFactory objects
Set xmlDNFObj = Nothing


To download the XML file associated with the above program please



download plant_catalog.xml from W3School

2 comments:

  1. Really nice post shared. There are so many tools which make the system well oriented and completely tested.. Thanks for sharing the post..

    ReplyDelete