How to count the no of objects in XML file(QTP)



How to count the no of objects in XML file(QTP)..

Answer / 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

More QTP Interview Questions

What is the difference betweent test and component?

1 Answers  


An object is created, i dont know the methods available for that object, i want to find methods available for that object and use the required method. How i can do this???

4 Answers   HCL,


When The Low Level Recording is Used in QTP

17 Answers  


Hi, I am supposed to automate mainframe application through qtp. I do not know how to start abt it. Can you plz help me in first initializing the process or do you anybody have a guide book or a link which guides me through the process of automating the mainframe applications and things involved in it.

0 Answers  


• Re –Engineering the regression testing from 0% to 60% automation. This has saved 4-mandays in every release. what doeas this statement means

2 Answers   Infosys,






in how many ways you perform batchtesting?

2 Answers   Sapient,


What are the features of quick test pro(qtp)?

0 Answers  


i have to prepare qtp certification course. so, please send me qtp tutorial notes.

1 Answers  


where do you store the test result?

2 Answers   HCL,


How you can delete excel file in qtp?

0 Answers  


How to use library files in QTP? how we can call these files in to script?

4 Answers   Virtusa, Wipro,


what is run-time object in qtp? explain with example?

2 Answers  


Categories