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
wt is the use of multiple questions in QTP
Hi All, I Want To excute scripts batch without using QC .I need code for that Thanks Balaji
How can you exit from an action?
How you can write contexts to text file in qtp?
What are the steps involved in recovery scenario wizard?
what is ODC and GDC?
Hi, Can anyone please tell me how to connect the QC with QTP using QTP script? Thanks in advance
in qtp 3 sheets is there in data table like global, action1, action2. I want to check the rows and columns in action2. how can check using script?
after initiating one project for testing, when exacltly QTP tester role starts?
Please guide me release notes of Automation once scripts are completed
What are the 3 main stages involved in testing with qtp?
How do you do batch testing in wr and is it possible to do in qtp, if so explain?
Hi,Sudhanandareddy plz forword framework and ppts for QTP to me. This is my mail id: ranjith_99reddy@yahoo.co.in (your contact number also)
when a test case is written how u test using qtp
How to run an integrated test scenario using Multiple Actions? How to use the QTP Step Generator?