title: Getting info out of XML document in VBA
body: <p>I'm using MSXML2 to load an XML file (a feed from Google Analytics).</p>
  
  <p>I now need to get data out of it, but I can't figure out how.</p>
  
  <p>This is the XML:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;feed xmlns='http://www.w3.org/2005/Atom' xmlns:dxp='http://schemas.google.com/analytics/2009' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/"dsdsdsdsdsdsdsd."' gd:kind='analytics#data'&gt;
    &lt;id&gt;http://www.google.com/analytics/feeds/data?ids=ga:2000000&amp;amp;dimensions=ga:campaign&amp;amp;metrics=ga:visits&amp;amp;filters=ga:campaign%3D%3Dcrosspromo&amp;amp;start-date=2010-08-26&amp;amp;end-date=2010-09-09&lt;/id&gt;
    &lt;updated&gt;2010-09-09T05:50:40.705-07:00&lt;/updated&gt;
    &lt;title&gt;Google Analytics Data for Profile 2000000&lt;/title&gt;
    &lt;link rel='self' type='application/atom+xml' href='https://www.google.com/analytics/feeds/data?max-results=50&amp;amp;end-date=2010-09-09&amp;amp;start-date=2010-08-26&amp;amp;metrics=ga%3Avisits&amp;amp;ids=ga%3A2000000&amp;amp;dimensions=ga%3Acampaign&amp;amp;filters=ga%3Acampaign%3D%3Dcrosspromo' /&gt;
    &lt;author&gt;
      &lt;name&gt;Google Analytics&lt;/name&gt;
    &lt;/author&gt;
    &lt;generator version='1.0'&gt;Google Analytics&lt;/generator&gt;
    &lt;openSearch:totalResults&gt;1&amp;lt;
    /openSearch:totalResults&amp;gt;
    &lt;openSearch:startIndex&gt;1&lt;/openSearch:startIndex&gt;
    &lt;openSearch:itemsPerPage&gt;50&lt;/openSearch:itemsPerPage&gt;
    &lt;dxp:aggregates&gt;
      &lt;dxp:metric confidenceInterval='0.0' name='ga:visits' type='integer' value='5070' /&gt;
    &lt;/dxp:aggregates&gt;
    &lt;dxp:dataSource&gt;
      &lt;dxp:property name='ga:profileId' value='2000000' /&gt;
      &lt;dxp:property name='ga:webPropertyId' value='UA-2000000-1' /&gt;
      &lt;dxp:property name='ga:accountName' value='test' /&gt;
      &lt;dxp:tableId&gt;ga:2000000&lt;/dxp:tableId&gt;
      &lt;dxp:tableName&gt;test&lt;/dxp:tableName&gt;
    &lt;/dxp:dataSource&gt;
    &lt;dxp:endDate&gt;2010-09-09&lt;/dxp:endDate&gt;
    &lt;dxp:startDate&gt;2010-08-26&lt;/dxp:startDate&gt;
    &lt;entry gd:etag='W/"CkMEQX47eSp7I2A9Wx5QGUQ."' gd:kind='analytics#datarow'&gt;
      &lt;id&gt;http://www.google.com/analytics/feeds/data?ids=ga:2000000&amp;amp;ga:campaign=crosspromo&amp;amp;filters=ga:campaign%3D%3Dcrosspromo&amp;amp;start-date=2010-08-26&amp;amp;end-date=2010-09-09&lt;/id&gt;
      &lt;updated&gt;2010-09-08T17:00:00.001-07:00&lt;/updated&gt;
      &lt;title&gt;ga:campaign=crosspromo&lt;/title&gt;
      &lt;link rel='alternate' type='text/html' href='http://www.google.com/analytics' /&gt;
      &lt;dxp:dimension name='ga:campaign' value='crosspromo' /&gt;
      &lt;dxp:metric confidenceInterval='0.0' name='ga:visits' type='integer' value='5070' /&gt;
    &lt;/entry&gt;&lt;/openSearch:totalResults&gt;
  &lt;/feed&gt;
  </code></pre>
  
  <p>Then I load the XML and search for the "entry" tag:</p>
  
  <pre><code>Dim objXML As MSXML2.DOMDocument
  Set objXML = New MSXML2.DOMDocument
  objXML.loadXML strXML
  Debug.Print objXML.getElementsByTagName("entry").Item(0).Text
  </code></pre>
  
  <p>But this outputs:</p>
  
  <pre><code>http://www.google.com/analytics/feeds/data?ids=ga:20000000&amp;ga:campaign=crosspromo&amp;filters=ga:campaign%3D%3Dcrosspromo&amp;start-date=2010-08-26&amp;end-date=2010-09-092010-09-08T17:00:00.001-07:00ga:campaign=crosspromo
  </code></pre>
  
  <p>Where's the rest of the data?
  If I try item(1) it fails...</p>