title: Parsing table data with jsoup
body: <p>I am using <a href="http://jsoup.org/" rel="nofollow">jsoup</a> in my android app to parse my html code but now I need parse table data and I can not get it to work. I try many ways but not successful so I want try luck here if anyone have experience.</p>
  
  <p><strong>Here is part of my html:</strong></p>
  
  <pre><code>&lt;div id="editacia_jedla"&gt;
      &lt;h2&gt;My header&lt;/h2&gt;
      &lt;h3&gt;My sub header&lt;/h3&gt;
  
      &lt;table border="0" class="jedalny_listok_tabulka" cellpadding="2" cellspacing="1"&gt;
      &lt;tr&gt;
          &lt;td width="100" class="menu_nazov neparna" align="left"&gt;Food Menu 1&lt;/td&gt;
          &lt;td class="jedlo neparna" align="left"&gt;vegetable and beef
          &lt;div class="jedlo_box_alergeny"&gt;Allergens: &lt;a href="#" class="alergen_1"&gt;1&lt;/a&gt;, &lt;a href="#" class="alergen_3"&gt;3&lt;/a&gt;&lt;/div&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td width="100" class="menu_nazov parna" align="left"&gt;Food Menu 2&lt;/td&gt;
          &lt;td class="jedlo parna" align="left"&gt;Potato salad and pork
          &lt;div class="jedlo_box_alergeny"&gt;Allergens: &lt;a href="#" class="alergen_6"&gt;6&lt;/a&gt;&lt;/div&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/table&gt;  
      etc
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>My java/android code:</strong></p>
  
  <pre><code>try {
              String tableHtmlCode="";
              Document fullHtmlDocument = Jsoup.connect(urlOfFoodDay).get();
              Element elm1 = fullHtmlDocument.select("#editacia_jedla").first();
              for( Element element : elm1.children() )
              {
                  tableHtmlCode+=element.getElementsByIndexEquals(2); //this set table content because 0=h2, 1=h3
              }
              Document parsedTableDocument = Jsoup.parse(tableHtmlCode);
              //Element th = parsedTableDocument.select("td[class=jedlo neparna]").first();  THIS IS BAD
              String foodContent="";
              String foodAllergens="";
          }
  </code></pre>
  
  <p>So now I want extract text <strong>vegetable and beef</strong> and save it to string foodContent and numbera 1, 3(together) from div class <strong>jedlo_box_alergeny</strong> save to string foodAllergens. Someone can help? I will very grateful for any ideas</p>