Hi. I am a newbie to QTP. I have created an xml file as follows and saved it as xml1.xml
<?xml versiion="1.0" encoding="UT-8"?>
Now I am trying to create an object of msxml2 class using vb script withing qtp(expert view).the code is as follows:
Dim describe, filepath
Set xmlDoc = CreateObject(”Msxml2.DOMDocument”)
Set ElemList = xmlDoc.getElementsByTagName(”class_list”)
filepath = ElemList.item(0).getAttribute(”filePath”)
when I am writing this code in a test in QTP, it is not recognizing the of the classes or associated methods. I chose visual basic, activeX and Web add-ins from start up window.all the basic vbs things like dim statements, msgbox etc. are identifiable by qtp, but when it comes to creating objects and using classes as mentioned above, not working.
My first concern is qtp is not identifying or highlighting any class such as Msxml2 etc. naturally all other objects and methods are not working.
1)any clue what could be the problem?
2)Please help me through the steps of reading data from an xml file in qtp and send the output of the test to another xml file.
3)when I create my xml file and try to open it through IE, it shows the above xml structure in IE. is this the expected output or the output of this xml file in IE should be displayed in a different way?
4) while reading xml and sending outout to another xml file,what do I have to set in the "record and run setting" option...since there are only two options web or windows applications to choose from.
any help is highly appreciated.
Loc: Stockholm, Sweden
1) Your XML has an invalid header and the elements and attributes in your code does not match your XML. Also change
xmlDoc.load(”"C:\Tests\xml-qtp\xml1.xml"”) to xmlDoc.load("C:\Tests\xml-qtp\xml1.xml").
2) Well, you are in the right direction...what data do you want to output?
3) IE usally displays XML correctly, however sometimes problem occurs with special characters
4) Use Record/Run to any open ...
Powered by UBB.threads™ 6.5.5