XML File handling Using QTP


QTP Descriptive programming with xml file handling

The following example uses the ItemByName property to confirm that the QTP attribute was added.

Set doc = XMLUtil.CreateXML()

doc.LoadFile "c:\example.xml"

Set root = doc.GetRootElement()

Set attrs = root.Attributes()

msg = "At first I had " & attrs.Count() & " attributes. "

root.AddAttribute "QTP","Great"

Set attr = attrs.ItemByName("QTP")

if attr is nothing then

msgbox "Failed to add attribute!!!"

end if

msg = msg + "Now I have " & attrs.Count() & " attributes. "

root.RemoveAttribute "QTP"

msg = msg + "Again I have " & attrs.Count() & " attributes."

msgbox msg


For gaining more insights in the automation using QTP log on to below url :

Automation Testing Using QTP


Post a Comment

أحدث أقدم