How To Read XML File From QTP
How To Read XML File From QTP
I'm going to show how to parse XML file and read its values from QTP
(QuickTest Professional).
For example, we will use this XML file:
I will use Microsoft's XML Parser also known as Microsoft.XMLDOM. This XML
parser allows running XPath queries.
Check the above bookstore XML file again and let's see:
Set node =
xmlDoc.SelectSingleNode("/bookstore/book[0]/title/text()")
MsgBox "Title of 1st book: " & node.NodeValue
Please see how QTP parses XML file and gets the required value:
Note: Pay attention that nodes are zero-indexed, i.e. first book is
book[0], second book is book[1], and so on.
You can check initial XML file and make sure that QTP parses it correctly.
Summary: