You are on page 1of 1



Login | Search

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
VB Script - Part II
<book id="bk101">
<author>Gambardella, Matthew</author>
VB Script - Part III
<title>XML Developer's Guide</title>
Working with Files using FSO <price>44.95</price>
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>
Parameterization <description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
Object Repository of the world.</description>
Descriptive Programming </catalog>

Regular Expression Code

Error Handling & Recovery 'Create Microsoft.XMLDOM object

Scenario Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
Output Values
'path of XML file
Database Connections
'Load the XML File
Automation Object Model xmlDoc.Load(XMLDataFile)

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

Msgbox "The name of Author is " & Author

Contact Us
'To get the description tag value in the XML file Set nodes = xmlDoc.SelectNodes("/catalog/book/description/text()")

Msgbox " total count of Description tag is " & nodes.length
+91- 9886477710 For i = 0 To (nodes.Length - 1)
Descripton= nodes(i).NodeValue
Msgbox "The Description is < " & Descripton & " > "

Set xmlDoc=nothing

Copyright 2013 Home | Demo videos | Students | Training | FAQ's | Feedback | About Us Designed By WebZone

1 of 1 1/29/2016 9:41 AM