reading xml file with vbscript reading xml file with vbscript xml xml

reading xml file with vbscript


First approach:

For Each Elem In NodeList    SET port = Elem.getElementsByTagName("Port")(0)   SET ip = Elem.getElementsByTagName("IPADDRESS")(0)   WScript.Echo "Port " & port.nodeValue & " has IP address is " & ip.nodeValueNext


This works for me:

sub main    Set nodeList = xmlDoc.documentElement.selectNodes("//interface")    For Each node in nodeList        handleNode(node)    Nextend subsub handleNode(node)    Dim port, ipaddress, netmask, attribute    For each elem in node.childNodes        Select Case node.tagName            Case "port"                port = elem.text            Case "ipaddress"                ipaddress = elem.text            Case "netmask"                netmask = elem.text            Case "tag with attributes"                attribute = elem.getAttribute("attributeName")        End Select    Next    WScript.Echo "Port " & port & " has IP address of " & ipaddress & " and useful attribute " & attributeend sub