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 |
1. Can anyone help me with recovery scenarios, each type with examples and also what is on error resume next?
How to make arguments optional in a function?
what r the executing modes in QTP
what is web application and client server application.is there any difference ?
How to handle the exceptions using recovery scenario manager in QTP?
why is execute file used.
How to supress warnings from the "Test results page"?
how can we handle errors other than using recovery scenerios in qtp
how do u handle an object with out name in our application using QTP 9.2?
IF we use batch testing.the result shown for last action only.in that how can i get result for every action.
what is the difference between an Action and a function in real time
What are the option you can use to synchronize your test?