title: API XML/JSON Response and VBA to parse it
body: <p>I have API which gives me the stock price based on constructed URL with token and symbol,this API returns is web based and returns XML/JSON format data in <code>&lt;root&gt;&lt;/root&gt;</code> and data in it. Below is an example.</p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;root&gt;
       &lt;n5323 type="float"&gt;31.35&lt;/n5323 &gt;
       &lt;n3221 type="float"&gt;9.06&lt;/n3221 &gt;
   &lt;/root&gt;
  </code></pre>
  
  <p>I would like to retrieve price in Excel using VBA (<code>31.35</code> and <code>9.06</code>), please help me on this how to achieve. Not that the <code>n5323</code> and <code>n3221</code> are generated dynamically and are different every time.</p>
  
  <p>My VBA code is as below</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim strXMLSite As String
  Dim objXMLHTTP As MSXML2.XMLHTTP
  Dim objXMLDoc As MSXML2.DOMDocument
  Dim objXMLNodexbrl As MSXML2.IXMLDOMNode
  Dim objXMLNodeDIIRSP As MSXML2.IXMLDOMNode
  Set objXMLHTTP = New MSXML2.XMLHTTP
  Set objXMLDoc = New MSXML2.DOMDocument
  
  strXMLSite = "http://testserver/volume/daily?token=' + token$ + '&amp;ticker='+Symbol$+'"
  
  objXMLHTTP.Open "POST", strXMLSite, False
  objXMLHTTP.send
  objXMLDoc.LoadXML (objXMLHTTP.responseText)
  
  Set objXMLNodexbrl = objXMLDoc.SelectSingleNode("root")
  Set objXMLNodeDIIRSP = objXMLNodexbrl.SelectSingleNode("root")
  
  Worksheets("Sheet1").Range("J1").Value = objXMLNodeDIIRSP.Text
  </code></pre>