' 2019-09-27 ' use the Microsoft XMLHTTP component to: ' go online and get a copy of the CD Catalog that is hosted on the www.w3schools.com website in XML. ' Display all of the received XML information ' Display the XML nodes / child nodes ' ' use the Microsoft MSXML2.DOMDocument component to: ' Display only the ARTISTS nodes, u newscript dim objHTTP = CreateObject("Microsoft.XMLHTTP") ' or ' Dim objHTTP = CreateObject("MSXML2.XMLHTTP") ' both work on my system! IF ( ! objHTTP ) THEN Message ="Could not create object" EXIT function END If dim OnlineURL = "https://www.w3schools.com/xml/cd_catalog.xml" dim OfflineFileName ="cd_catalog.xml" dim res = objHTTP.Open ( "GET", OnlineURL , False) objHTTP.send dim waitLoop = 50 DO res = objHTTP.status IF res == 200 THEN ' HTML code for finished waitLoop = 0 ELSE waitLoop = waitLoop - 1 END IF LOOP while waitLoop message = "This is the response " & chr(0x0a) & chr(0x0a) & objHTTP.responseText freestring = "" dim indent= " " SUB treewalk ( node ) dim child indent= indent & " " FOR each child in node.childnodes IF ( child.hasChildNodes = 0) then freestring = freestring & chr(0x0a) & indent & child.nodeValue ELSE freestring = freestring & chr(0x0a) & indent & child.nodeName CALL treewalk ( child ) END if NEXT child indent = left ( indent , -2) END sub CALL treewalk (objHTTP.responseXML ) message = freestring dim DOM = CreateObject("MSXML2.DOMDocument.6.0") DOM = objHTTP.responseXML dim txt = "" dim x = DOM.getElementsByTagName("ARTIST") dim i FOR i = 0 to x.length -1 txt = txt & x.item(i).childNodes.item(0).nodeValue & "
" NEXT i message = txt ' script finished