title: How to parse a page with multiple tables
body: <p>Any idea on how to scrape a web page with multiple tables?
  I am connecting to the web page </p>
  
  <p>This is one table but on the same web page there are multiple tables</p>
  
  <p>I also cant figure out how to read the table...</p>
  
  <p>XML:</p>
  
  <pre><code>    &lt;p&gt;&lt;a href="/fantasy_news/feature/?ID=49818"&gt;&lt;strong&gt;Top 300 Overall Fantasy Rankings&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt; 
  &lt;div class="storyStats"&gt; 
  &lt;table&gt; 
  &lt;thead&gt; 
  &lt;tr&gt; 
  &lt;th&gt;RANK&lt;/th&gt; 
  &lt;th&gt;CENTRES&lt;/th&gt; 
  &lt;th&gt;TEAM&lt;/th&gt; 
  &lt;th&gt;POS&lt;/th&gt; 
  &lt;th&gt;GP&lt;/th&gt; 
  &lt;th&gt;G&lt;/th&gt; 
  &lt;th&gt;A&lt;/th&gt; 
  &lt;th&gt;PTS&lt;/th&gt; 
  &lt;th&gt;+/-&lt;/th&gt; 
  &lt;th&gt;PIM&lt;/th&gt; 
  &lt;th&gt;PPP&lt;/th&gt; 
  &lt;/tr&gt; 
  &lt;/thead&gt; 
  &lt;tbody&gt; 
  &lt;tr class="bg1"&gt; 
  &lt;td&gt;1.&lt;/td&gt; 
  &lt;td&gt;&lt;a href="/nhl/teams/players/?name=steven+stamkos"&gt;Steven&amp;nbsp;Stamkos&lt;/a&gt;&lt;/td&gt; 
  
  &lt;td&gt;Tampa Bay&lt;/td&gt; 
  &lt;td&gt;C&lt;/td&gt; 
  &lt;td align="right"&gt;81&lt;/td&gt; 
  &lt;td align="right"&gt;50&lt;/td&gt; 
  &lt;td align="right"&gt;51&lt;/td&gt; 
  &lt;td align="right"&gt;101&lt;/td&gt; 
  &lt;td align="right"&gt;-2&lt;/td&gt; 
  &lt;td align="right"&gt;56&lt;/td&gt; 
  &lt;td align="right"&gt;38&lt;/td&gt; 
  &lt;/tr&gt; 
  
  
  Iterator&lt;Element&gt; trSIter = doc.select("table")
              .iterator();
      while (trSIter.hasNext()) {
          Element trEl = trSIter.next().child(0);
          Elements tdEls = trEl.children();
          Iterator&lt;Element&gt; tdIter = tdEls.select("tr").iterator();
          System.out.println("&gt;&lt;1&gt;&lt;&gt;&lt;"+tdIter);
          boolean firstRow = true;
          while (tdIter.hasNext()) {
  
              Element tr = (Element) tdIter.next();
  
  
              while (tdIter.hasNext()) {
                  int tdCount = 1;
                  Element tdEl = tdIter.next();
                  //name = tdEl.getElementsByClass("playertablePlayerName").get(0).text();
  
                  Elements tdsEls = tdEl.select("td");
                  System.out.println("&gt;&lt;2&gt;&lt;&gt;&lt;"+tdsEls);
                  Iterator&lt;Element&gt; columnIt = tdsEls.iterator();
  
                  while (columnIt.hasNext()) {
  
                      Element column = columnIt.next();
                      switch (tdCount++) {
                      case 1:
                          name =column.select("a").first().text();
  
                          break;
                      case 2:
                          stat2 = Double.parseDouble(column.text());
                          break;
                      case 3:
                          stat3 = Double.parseDouble(column.text());
                          break;
                      case 4:
                          stat4 = Double.parseDouble(column.text());
                          break;
                      case 5:
                          stat5 = Double.parseDouble(column.text());
                          break;
                      case 6:
                          stat6 = Double.parseDouble(column.text());
                          break;
                      case 7:
                          stat7 = Double.parseDouble(column.text());
                          break;
                      case 8:
                          stat8 = Double.parseDouble(column.text());
                          break;
  </code></pre>