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

Why do we use "Text checkpoint" If we can make use of it in "standard checkpoint" ?

1486


When ‘option explicit’ keyword is used in qtp?

750


i can done the project with QTP in that time i can say how many members in my team size?

1372


Hi Friends, Would be great if you can provide the Model Question paper, Web site link or any reference s. Thanks & Regards, Byzoor,

1348


Can an action have 2 shared object repositories associated with them? In that case, if two of them contain the same object, which one will be considered?

589






How you can find the absolute value of the number in qtp?

524


What is the use of sendkeys and what are send keys

1954


What is the difference between rational rose and QTP?

1782


i need qtp tutorial. pls send it to sridhar.k151@g mail.com

1641


What is RTM (require ment tracebulity marix) fromate?

1529


In application which areas to be automated and what kind of situation will be take? using QTP? Plz give me the clear answer

1942


What are the general steps involved in the data driven framework?

556


How to export quicktest professional (qtp) results to an .xls file?

601


I got some information from the QTP help.But i am not sure whether through this process will QTP work or not bellow is the Help what I have Remote setup Settings Remote WSH, which is a new technology included in WSH 5.6, provides the ability to run a script on a remote machine or machines. With Remote WSH, the script is physically copied from the local machine to the remote machine before executing. In order to enable Remote WSH functionality, you must first set up the remote machine with the proper security settings. The steps below perform the tasks that enable Remote WSH. Note Both the remote and local machines must be running Windows NT 4 SP3 or greater in order to use Remote WSH. To enable a machine to run remote scripts 1. Install WSH V5.6 on the machine. If you are using Windows 2001 or have installed Internet Explorer 6 or greater, WSH 5.6 has already been installed. Note WSH 5.6 is available for download from the web at http://msdn.microsoft.com/scripting 2. Add yourself to the remote machine's Local Administrators group. 3. To enable Remote WSH, use Poledit.exe on the server. Note An administrator who wants to enable Remote WSH must either acquire the Windows 2000 resource kit, or use http://msdn.microsoft.com/scripting to acquire the necessary windowsscript.adm file that contains the WSH settings. The windowsscript.adm file must be copied to the server that sets the gapplicabel group's policies. Although it is not necessary to copy the file to the server's \WINNT\INF directory, this is nonetheless where the default adm files are located. Note For more information on Poledit.exe, see the Poledit.exe's online help system. 4. WSH should now be enabled on the machine. To test it,. WSH 5.6 can run scripts that reside on remote systems. The following scripts demonstrate this capability. These scripts make the assumption that the files are located on a local machine directory called "c:\wsh5.6"; change the local path and the remote machine name as necessary. After initially running RemoteTest.WSF on the local machine, there may be a small pause as DCOM verifies your identity. After you see the "Done" message, a file named "c:\beenhere.txt" on the remote machine indicates the time that you executed the command (from the remote computer's clock). Script to run scripts remotely set oController = CreateObject("WSHController") set oProcess= oController.CreateScript("c:\wsh5.6\beenhere.wsf","remmachine") oProcess. Execute Could you tell me will it work fine

1800


What is the keyword view and expert view in qtp?

537