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 @ Friday, September 22, 2006 9:09 AM