The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:
Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> HP Functional Testing / Mercury QuickTest Pro / QTP

Pages: 1
anjalika400
Newbie


Reged: 02/11/08
Posts: 2
reading an XML file in QTP
      #485168 - 05/21/08 11:44 PM

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"?>
<class_list>
<student>
<name>Steve</name>
<grade>A</grade>
</student>
<student>
<name>Mellisa</name>
<grade>A-</grade>
</student>
</class_list>
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
Dim xmlDoc
Set xmlDoc = CreateObject(”Msxml2.DOMDocument”)
xmlDoc.load(”"C:\Tests\xml-qtp\xml1.xml"”)
Set ElemList = xmlDoc.getElementsByTagName(”class_list”)
filepath = ElemList.item(0).getAttribute(”filePath”)
MsgBox 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.

Anjali


Post Extras: Print Post   Remind Me!   Notify Moderator  
stth10
Junior Member


Reged: 01/26/06
Posts: 371
Loc: Stockholm, Sweden
Re: reading an XML file in QTP [Re: anjalika400]
      #485249 - 05/22/08 03:07 AM

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 ...

--------------------
/Stefan

http://abouttesting.blogspot.com/
http://advancedqtp.com/


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 46 anonymous users are browsing this forum.

Moderator:  IanFraser, Rajkumar_Rajangam, thorwath, TReddy, AJ, Tarun Lalwani, mwsrosso 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 4415

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5