Friday, January 29, 2010

How to view the VALUE of elements in a message box, one at a time.

XMLUtil-3: How to view the VALUE of elements in a message box, one at a time.

XML file used:

'To view the value of elements in a msgbox one at a time
Set xmldoc=XMLUtil.CreateXML()
xmldoc.loadfile "c:\blog.xml"
Set chldrn = xmldoc.ChildElementsByPath( "/ bookstore/book/title")
For i=1 to chldrn.count
msgbox chldrn.item(i)
Next

 

 

Above if you write the fifth line of code as

msgbox chldrn.item(i).value instead of msgbox chldrn.item(i)

You will get values like shown below


For more on CreateXML, LoadFile, ChildElementsByPath see here and here.

Also See:
How to find total number of child elements.
How to view ALL elements in a message box, one at a time.
How to get the NAME of the root element, get the COUNT of child
elements of root, get COUNT & NAMES of children of any child element of root.

How to create a new XML file.
How to move/transfer text from XML file to QTP DataTable.
How to compare two XML files.