title: Web scraping from div, class and span elements
body: <p>I want to extract data from <a href="http://www.espanol.spindices.com/" rel="nofollow noreferrer">S&amp;P Down Jones Indices web site</a>. The relevant data is embedded in this code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="indices-detail-container"&gt;
    &lt;div id="all-indices-slider" class="slides" style="float: none; position: absolute; top: 0px; left: -5px; margin: 0px; width: 6318px; height: 113px;"&gt;
  
     &lt;div class="index-detail"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/dow-jones-sustainability-chile-index-clp" title="DJSI Chile" contentidentifier="2e9cb165-0cbf-4070-a5ef-dc20bf6219ba" contenttype="web-page" contenttitle="Dow Jones Sustainability™ Chile Index (CLP)"&gt;DJSI Chile&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;943.76 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt;0.07% ▲&lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-bvl-peru-general-index-pen" title="S&amp;amp;P/BVL Peru General Index (PEN)" contentidentifier="cec2fa99-13f9-4bf5-9770-4832d86dc017" contenttype="web-page" contenttitle="S&amp;amp;P/BVL Peru General Index (PEN)"&gt;S&amp;amp;P/BVL Peru General Index ...&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;9,922.82 &lt;/span&gt;
       &lt;span class="daily-change  down "&gt;-0.04% ▼ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-bvl-peru-select-index" title="S&amp;amp;P/BVL Peru Select Index" contentidentifier="162ea564-b038-493c-a3bc-5f56bda60bb4" contenttype="web-page" contenttitle="S&amp;amp;P/BVL Peru Select Index"&gt;S&amp;amp;P/BVL Peru Select Index&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;188.02 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 0.18% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail last"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-bvl-lima-25-index-pen" title="S&amp;amp;P/BVL LIMA 25 Index (PEN)" contentidentifier="12f6a899-f5f6-4c6f-9a82-9db3da8d2821" contenttype="web-page" contenttitle="S&amp;amp;P/BVL LIMA 25 Index (PEN)"&gt;S&amp;amp;P/BVL LIMA 25 Index (PEN)&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;13,153.1 &lt;/span&gt;
       &lt;span class="daily-change  down "&gt; -0.3% ▼ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail no-bottom-border"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-bvl-mining-index-pen" title="S&amp;amp;P/BVL Mining Index (PEN)" contentidentifier="2bef26d1-5720-457f-838a-761a176b06a6" contenttype="web-page" contenttitle="S&amp;amp;P/BVL Mining Index (PEN)"&gt;S&amp;amp;P/BVL Mining Index (PEN)&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;117.81 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 1.15% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail no-bottom-border"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-lac-40-us" title="S&amp;amp;P Latin America 40" contentidentifier="41ac7d89-a7d8-49d7-8d15-ff9bbc22a17a" contenttype="web-page" contenttitle="S&amp;amp;P Latin America 40"&gt;S&amp;amp;P Latin America 40&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;2,213.49 &lt;/span&gt;
       &lt;span class="daily-change  down "&gt; -0.49% ▼ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail no-bottom-border"&gt;
       &lt;h5&gt;&lt;a href="/indices/fixed-income/sp-valmer-mexico-government-cetes-index" title="S&amp;amp;P/Valmer Mexico Government CETES Index" contentidentifier="d1973dbe-ce5e-4757-b5d5-face93abbb7c" contenttype="web-page" contenttitle="S&amp;amp;P/Valmer Mexico Government CETES Index"&gt;S&amp;amp;P/Valmer Mexico ...&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;201.36 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 0.01% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail last no-bottom-border"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-mila-andean-40-index" title="S&amp;amp;P MILA Andean 40" contentidentifier="b5374c9e-85b3-44c1-a37e-dd1f8d3abb1b" contenttype="web-page" contenttitle="S&amp;amp;P MILA Andean 40"&gt;S&amp;amp;P MILA Andean 40&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;439.28 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 0.41% ▲ &lt;/span&gt;
     &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class="index-slide" style="margin-right: 5px;"&gt;
  
     &lt;div class="index-detail"&gt;
       &lt;h5&gt;&lt;a href="/indices/commodities/dow-jones-commodity-index" title="DJCI" contentidentifier="338b4dbf-d7eb-470b-9b17-8c713c4612ab" contenttype="web-page" contenttitle="Dow Jones Commodity Index"&gt;DJCI&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;234.06 &lt;/span&gt;
       &lt;span class="daily-change  down "&gt; -1.05% ▼ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-500" title="S&amp;amp;P 500" contentidentifier="725e00f8-85c7-4fef-87f6-1c11be7f6517" contenttype="web-page" contenttitle="S&amp;amp;P 500®"&gt;S&amp;amp;P 500&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;2,051.35 &lt;/span&gt;
       &lt;span class="daily-change  down "&gt; -1.05% ▼ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-mila-pacific-alliance-composite" title="S&amp;amp;P MILA Pacific Alliance Composite" contentidentifier="3baf0ead-3784-4daf-9333-2f32470ddb4e" contenttype="web-page" contenttitle="S&amp;amp;P MILA Pacific Alliance Composite"&gt;S&amp;amp;P MILA Pacific Alliance ...&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;349.36 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 1.54% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail last"&gt;
       &lt;h5&gt;&lt;a href="/indices/commodities/sp-gsci" title="S&amp;amp;P GSCI" contentidentifier="dd11d7c8-0c9b-492c-8242-1017e4d41c29" contenttype="web-page" contenttitle="S&amp;amp;P GSCI"&gt;S&amp;amp;P GSCI&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;2,121.09 &lt;/span&gt;
       &lt;span class="daily-change  down "&gt;-1.03% ▼ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail no-bottom-border"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-latin-america-bmi-us-dollar" title="S&amp;amp;P Latin America BMI" contentidentifier="c9ba7da8-4dcb-4a7d-9a81-ae8497a9f1db" contenttype="web-page" contenttitle="S&amp;amp;P Latin America BMI"&gt;S&amp;amp;P Latin America BMI&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;189.48 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 1.08% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail no-bottom-border"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-ifci-latin-america-price-index-in-us-dollar" title="S&amp;amp;P/IFCI Latin America" contentidentifier="b22825f7-d873-4e96-818d-28036f7dba27" contenttype="web-page" contenttitle="S&amp;amp;P/IFCI Latin America"&gt;S&amp;amp;P/IFCI Latin America&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;1,228.91 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 0.35% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail no-bottom-border"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-latin-america-infrastructure-index" title="S&amp;amp;P Latin America Infrastructure" contentidentifier="b3751332-cf1c-4fb2-8e46-733932ed6989" contenttype="web-page" contenttitle="S&amp;amp;P Latin America Infrastructure Index"&gt;S&amp;amp;P Latin America ...&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;1,055.92 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 2.79% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail last no-bottom-border"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-latin-america-adr-index" title="S&amp;amp;P Latin America ADR" contentidentifier="91c85053-fa63-448b-9b5f-7f34f0afa964" contenttype="web-page" contenttitle="S&amp;amp;P Latin America ADR Index"&gt;S&amp;amp;P Latin America ADR&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;205.43 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 2.17% ▲ &lt;/span&gt;
     &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class="index-slide" style="margin-right: 5px;"&gt;
  
     &lt;div class="index-detail"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-mila-pacific-alliance-select" title="S&amp;amp;P MILA Pacific Alliance Select" contentidentifier="5da0480d-e00f-4dd6-a99f-8c9d01dfe859" contenttype="web-page" contenttitle="S&amp;amp;P MILA Pacific Alliance Select"&gt;S&amp;amp;P MILA Pacific Alliance ...&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;3,842.7 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 1.63% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail"&gt;
       &lt;h5&gt;&lt;a href="/indices/equity/sp-mila-pacific-alliance-completion-index" title="S&amp;amp;P MILA Pacific Alliance Completion" contentidentifier="cb45f262-959e-4eab-b9e2-abddd4efc6e6" contenttype="web-page" contenttitle="S&amp;amp;P MILA Pacific Alliance Completion"&gt;S&amp;amp;P MILA Pacific Alliance ...&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;477.39 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 1.45% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail"&gt;
       &lt;h5&gt;&lt;a href="/indices/fixed-income/sp-valmer-mexico-government-international-1-year-ums-index" title="S&amp;amp;P/Valmer Mexico Government International 1+ Year UMS Index" contentidentifier="6b29ea9c-3a43-4c09-94b5-a5fe93fac9b4" contenttype="web-page" contenttitle="S&amp;amp;P/Valmer Mexico Government International 1+ Year UMS Index"&gt;S&amp;amp;P/Valmer Mexico ...&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;327.07 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 0.12% ▲ &lt;/span&gt;
     &lt;/div&gt;
  
     &lt;div class="index-detail last"&gt;
       &lt;h5&gt;&lt;a href="/indices/fixed-income/sp-valmer-mexico-government-1-5-year-mbonos-index" title="S&amp;amp;P/Valmer Mexico Government 1-5 Year MBONOS Index" contentidentifier="16d4060c-3a31-4efa-8c57-239c679bb779" contenttype="web-page" contenttitle="S&amp;amp;P/Valmer Mexico Government 1-5 Year MBONOS Index"&gt;S&amp;amp;P/Valmer Mexico ...&lt;/a&gt;&lt;/h5&gt;
       &lt;span class="return-value"&gt;244.56 &lt;/span&gt;
       &lt;span class="daily-change  up "&gt; 0.05% ▲ &lt;/span&gt;
     &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>There's a big section that encapsulates the indices data, with <code>class</code> defined as <code>indices-detail-container</code>. Inside this section there are three sub sections, one defined with <code>class</code> <code>all-indices-slider</code> and the last two defined with <code>class</code> <code>index-slide</code>. The data I want to extract is inside these three sub sections and is contained in:</p>
  <pre><code>&lt;div class=&quot;index-detail&quot;&gt;
      ...
  &lt;/div&gt;
  </code></pre>
  <p>Specifically I want the <code>content title</code> and the <code>return-value</code> inside the <code>index-detail</code> classes. For example, for the first item I'd like:</p>
  <blockquote>
  <p>Title = &quot;Dow Jones Sustainability™ Chile Index&quot; or &quot;DJSI Chile&quot;</p>
  <p>Value= 943.76</p>
  </blockquote>
  <p>I was thinking I could use the <code>contentidentifier</code> tag inside the heading element <code>&lt;h5&gt;</code>, however I don't know how to call the tag to discriminate between the indices.</p>
  <p>So far I have:</p>
  <pre><code>Sub Dow_HistoricalData()
  
      Dim xmlHttp As Object
      Dim TR_col As Object, TR As Object
      Dim TD_col As Object, TD As Object
      Dim row As Long, col As Long
  
      Set xmlHttp = CreateObject(&quot;MSXML2.XMLHTTP.6.0&quot;)
      xmlHttp.Open &quot;GET&quot;, &quot;http://www.espanol.spindices.com/&quot;, False
      xmlHttp.setRequestHeader &quot;Content-Type&quot;, &quot;text/xml&quot;
      xmlHttp.send
  
      Dim html As Object
      Set html = CreateObject(&quot;htmlfile&quot;)
      html.body.innerHTML = xmlHttp.responseText
  
      Dim tbl As Object
      Set tbl = html.getElementById(&quot;all-indices-slider&quot;)
  
  End Sub
  </code></pre>