Professional Documents
Culture Documents
cid=86
Chapters XML
Upcoming Trainings
How to get the values of the XML tags ?
QTP Interview Questions
VB Script - Part I => Content of "sample.xml" file from which the tag values will retrieved using below code
<catalog>
VB Script - Part II
<book id="bk101">
<author>Gambardella, Matthew</author>
VB Script - Part III
<title>XML Developer's Guide</title>
<genre>Computer</genre>
Working with Files using FSO <price>44.95</price>
<publish_date>2000-10-01</publish_date>
Excel <description>An in-depth look at creating applications
with XML.</description>
Actions </book>
<book id="bk102">
Functions <author>Ralls, Kim</author>
<title>Midnight Rain</title>
Difference between Action and <genre>Fantasy</genre>
Function <price>5.95</price>
<publish_date>2000-12-16</publish_date>
Parameterization <description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
Object Repository of the world.</description>
</book>
Descriptive Programming </catalog>
Synchronization 'Give the XML path of XML tag you want to access and /text() to access the value of tag.
'XML path follows the hierarchy
Environment Variables 'XML path for author tag will start from catalog->book->author
'so the XML path will be /catalog/book/author
XML 'Text() will gie the value of the tag
Set nodes = xmlDoc.SelectNodes("/catalog/book/author/text()")
Outlook Msgbox " total count of Author tag is " & nodes.length
For i = 0 To (nodes.Length - 1)
Reporting Defect Author= nodes(i).NodeValue
Next
Contact Us
'To get the description tag value in the XML file
Set xmlDoc=nothing
Copyright QTPWorld.com 2013 Home | Demo videos | Students | Training | FAQ's | Feedback | About Us Designed By WebZone
1 of 1 1/29/2016 9:41 AM