Geeks With Blogs

News QTP and Stuff
Theo Moore Questions... Morphology? Longevity? Incept dates?

I saw a question in the MIC forums today about how to get at specific data located in an XML file. The user was wondering how she could get at in a hierarchy. She was loading her file, but not as an XML file.

I gave her a good example, and here's the key: It's really pretty easy:

Dim oXML

Set oXML = CreateObject(”Microsoft.XMLDOM”)

oXML.Load sPathToXML

<Do stuff>

Set oXML = Nothing

And that's it to load an XML file. Really.

Once you have the XML document loaded, you can use all kinds of functions to get at the data and mainpulate it. Too many QTP script writers seem reluctant to fully accept this approach, instead relying on the tool (I am not a fan of the tool based solutions) to try and get at what they need.

Yes, it does require learning a new discipline, but it is completely worth it.

Here's a great reference on what you can do with the XMLDOM once you have the file loaded.

Posted on Friday, September 22, 2006 9:09 AM | Back to top


Comments on this post: QTP: Using XML files

# re: QTP: Using XML files
Requesting Gravatar...
its really good to know this point, could you please explain me the background process of QTP verifying a xml file content using a xml checkpoint.

Anfal
Left by Anfal on Apr 11, 2007 7:22 AM

# re: QTP: Using XML files
Requesting Gravatar...
its really good to know this point, could you please explain me the background process of QTP verifying a xml file content using a xml checkpoint.

Anfal
Left by Anfal on Apr 11, 2007 7:22 AM

# re: QTP: Using XML files
Requesting Gravatar...
its really good to know this point, could you please explain me the background process of QTP verifying a xml file content using a xml checkpoint.

Anfal
Left by Anfal on Apr 11, 2007 7:22 AM

# re: QTP: Using XML files
Requesting Gravatar...
hi,

i want to know , how we can create a xml file of qtp object repository file objects.
Left by M Dora Babu - Banglore on Jul 11, 2007 2:47 AM

# re: QTP: Using XML files
Requesting Gravatar...
using XMLUtil.createXML and loadfile I have loaded the XML file. Pls guide me how do I retrieve the attributes of the child? My code looks like this

Set objdoc=XMLUtil.CreateXML()
objdoc.loadFile = "C:\Test.xml"

set root = objdoc.GetRootElement()
set children = root.ChildElements()

set firstchild = children.item(1)
set secondchild = children.item(1).ChildElements()

For i = 1 to secondchild.count()
secondchild.item(i).ElementName()
Next

How will I get the attributes and the values of the secondchild.item(i).ElementName()
Left by Aruna on Mar 11, 2008 8:31 AM

# re: QTP: Using XML files
Requesting Gravatar...
im not able to load a xml file please send me the guidelines how to load it
Left by janani on Mar 17, 2008 12:40 AM

# re: QTP: Using XML files
Requesting Gravatar...
-----# re: QTP: Using XML files
left by Anfal at 4/11/2007 7:22 AM its really good to know this point, could you please explain me the background process of QTP verifying a xml file content using a xml checkpoint. ---
Hi Anfal....i am couple of years behind you but i now have the same queston. i am sure u have the answer by now. PLease share with me the answer
thanks
Reenu
Left by Reenu on Mar 21, 2008 6:18 PM

# re: QTP: Using XML files
Requesting Gravatar...
I have created xml and imported.
With name title properties i was trying to identify the object. i found that explicilty i have to add the properties in the Object propeties dialog box and then only it was showing me the associated value for that property in the Object propeties dialog box.
And then i was able to highlight the object.

Can anyone tell me how to avoid this manual selecting of the object properties after importing the xml?
Is there any setting i have to do in Object Repository Manager?
Left by Sonali on May 09, 2008 3:48 AM

Comments have been closed on this topic.
Copyright © Theo Moore | Powered by: GeeksWithBlogs.net