How to count the no of objects in XML file(QTP)
Answer Posted / uday kumar_anem
' To find the number of child elements for a specified
parent
Set doc = XMLUtil.CreateXML()
doc.LoadFile "e:\sample.xml"
Set elementCol = doc.ChildElementsByPath
("/Environment/Variable")
temp=elementCol.Count
msgbox(temp)
'To Find the numer of child elements for a root
Set doc=XMLUtil.CreateXML()
doc.loadfile "e:\sample.xml"
Set root = doc.GetRootElement()
temp=root.ChildElements().count
msgbox(temp)
My sample XML file is like:
<Environment>
<Variable>
<Name>Name</Name>
<Value>Uday Kumar</Value>
</Variable>
<Variable>
<Name>Designation</Name>
<Value>Senior Software Engineer</Value>
</Variable>
</Environment>
| Is This Answer Correct ? | 10 Yes | 2 No |
Post New Answer View All Answers
What are the main differences of qtp and win runner?
I used child objects to get the no of weblist present in the weblist.now i need to select the items present in each weblist ?How to do so
How to find array size in qtp?
Explain the concept of object repository & how qtp recognizes objects?
how to download mercury qtp9.2 ny internet ?
What is action? How many types of actions are there in qtp?
How do you open adobe acrobat file in QTP and do some testing on that file ?
Explain the types of object repository?
What are the types of data tables in qtp?
I had installed QTP 9.2. It is working fine but whenever I open QTP, it is trying to reinstall the below-mentioned files again and again "QTP92PS82UPGRADE.exe", "recogn.dll". If anybody has these files, please provide those files in this site or you can send that files to my mail id also (lravi4u@yahoo.com). If you don't know where the files will be in the QTP, search in the QTP software CD or path of QTP program installed (C:\Program Files\Mercury Interactive\QuickTest Professional)
How you can make an action as re-usable action?
write the vb script for call to new action in qtp?
Give the syntax to load function at run time.
Explain runtime dynamic settings?
What are the different types of recording modes?