none
Was : VBA Post to URL And read Text HTML ; Now checking XML version RRS feed

  • Question

  • I might be overdoing the recasting.  And not certain if I can pass an entire Object by ChildNodes.

    I've setup IExml, xmlDoc, xmlDME and XMLTags to read through the following XML.

    En route to getting the two values, 531 and 7178, for example.


    Sub GetXMLTextfromURL() '' (urlk As String) Early Binding of HTML to Late Binding of XML ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc '' Algorithm : '' 1) Start request to XMLHTTP60 ie response XML Object '' 2) Request is manifested as an XMLobject that has the tagNames. '' as in DOMDocument60 (ie XML response Object) '' 3) Establish sets of elements in DOM Document with IXMLDOMElement '' 4) Continue through Elements to Identify distance, duration. '' 5) ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc '' window was opened to investigate the response :via Internet Controls '' Dim IE As New SHDocVw.InternetExplorer Dim IExml As New MSXML2.XMLHTTP60 '' This is the inner network space not displayed. ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc '' return the xml source for the node and each of its descendants '' is allocated in DOMDocument60 class as complete XML. Dim xmlDoc As New MSXML2.DOMDocument60 '' W3C-DOM XML Document 6.0 (Apartment) ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

    '' Establish property documentElement into the IXMLDOMElement class Dim xmlDME As New MSXML2.DOMDocument60 ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc '' Dim HTMLInput As MSHTML.IHTMLElement Dim xmlTags As New MSXML2.IXMLDOMElement

    '' continue Algorithm::

    '' Dim HTMLTags As MSHTML.IHTMLElementCollection '' Dim HTMLTag As MSHTML.IHTMLElement '' ...the means of generating HTML information web scrape set... '' ...designating how to generate XML information web scrape set. ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc '' I'm not certain of the visibility states. Run true '' to test whether XMLHTTP60 is calling the network.

    ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc   IExml.Visible = True IExml.Open "GET", "https://maps.googleapis.com/maps/api/" &_

    "distancematrix/xml?origins=" & _ "18631+N+19th+Avenue+Phoenix+AZ" &_

    "&destinations=2929+W+Thunderbird+Road+Phoenix+AZ" & _ "&mode=car&sensor=false&key=[google api key]", False Do While IExml.readyState <> READYSTATE_COMPLETE ''sim: Application.Wait Now + TimeValue("00:00:01") ''sim: DoEvents Loop ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc '' Recasting the Requested XML into the Element locatable '' I assume xmlDoc is like a storage of the general XML Get, '' and xlmDOM setups a working tablet of the readable Document '' There is a method of denoting all nodes as child nodes, then '' assigning the nodes into the IXMLDOMNode ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ''<--  Recast|active HTTP into inactive class xmlDoc = IExml.responseXML

    ''<--  pass constructs by ChildNodes
    xmlDME.ChildNodes = xmlDoc.ChildNodes

    ''<--  Recast xmlDME into xmlTags

    xmlTags = xmlDME.getElementsByTagName For Each xmlTags.tagName In xmlTags Debug.Print xmlTags.tagName("Value"), xmlTags.tagName Next xmlTags.tagName '' -------------------------------------------------------------------------------------- '' Next, to dial through TAGS '' similar to: surfacing only the Value elements as follows: '' <> distance = IE.document("distancematrixresponse").Row("element"). _

    '' distance("Value") ''cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc End Sub


    I think the owl is good.  Navaho says it means death. 

    I'll pass my google API if your assisting the same route.


    RO




    • Edited by RefugioM Wednesday, May 1, 2019 1:10 AM
    Wednesday, May 1, 2019 1:00 AM