Code to get tagnames and values from an xml

In continuation from the previous post where we try and get the attribute values from an xml, here is the code where we get the tag names and its values :

Const xmlFile1= "C:\Test.xml"
Set xmlDoc1 = CreateObject("Msxml2.DOMDocument")
set nodes1 = xmlDoc1.selectNodes("//*")
for i = 0 to nodes1.length -1
        tagname1 = nodes1(i).nodeName
        val1 = nodes1(i).text
        If  tagname1= "test" Then
                msgbox tagname1
                msgbox val1
                Exit for
        End If

Hope this helps , happy testing!


Popular posts from this blog

Trim / Remove spaces in Xpath?

RPA - Blue Prism, OpenSpan, Automation Anywhere vs UIPath