QTP: Using XML files

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.

«September»
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567