Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

wt is the use of multiple questions in QTP

2137


Hi All, I Want To excute scripts batch without using QC .I need code for that Thanks Balaji

1816


How can you exit from an action?

1046


How you can write contexts to text file in qtp?

1045


What are the steps involved in recovery scenario wizard?

965


what is ODC and GDC?

7861


Hi, Can anyone please tell me how to connect the QC with QTP using QTP script? Thanks in advance

1897


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?

7160


after initiating one project for testing, when exacltly QTP tester role starts?

1913


Please guide me release notes of Automation once scripts are completed

1884


What are the 3 main stages involved in testing with qtp?

1074


How do you do batch testing in wr and is it possible to do in qtp, if so explain?

953


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)

2398


when a test case is written how u test using qtp

2112


How to run an integrated test scenario using Multiple Actions? How to use the QTP Step Generator?

3966