title: how to parse two tables from HTML using jsoup?
body: <p>I need to parse the two tables in HTML using jsoup library from the site <a href="http://www.informatik.uni-trier.de/~ley/pers/hd/k/Kumar:G=_Praveen.html" rel="nofollow">http://www.informatik.uni-trier.de/~ley/pers/hd/k/Kumar:G=_Praveen.html</a>
  ..
  Since there are two tables on the page ,I do not know how excatly to parse the table contents.I need to extract the contents of the 1st table, that is only author names and their publications and the 2nd table which is at the end named coauthors…
  I tried to code (code given below)but it gives errors…</p>
  
  <pre><code>public class Main {
      public static void main(String[] args) {
          try {
              Document doc =Jsoup.connect(“http://www.informatik.unitrier.de/~ley/pers/hd/k/Kumar:G=_Praveen.html“).get();
              Elements trs = doc.select(“table tr”);
              Element table = doc.select(“table[class=coauthor]“).first();
              Iterator ite = table.select(“td”).iterator();
              ite.next();
              System.out.println(“Value 1: ” + ite.next().text());
              System.out.println(“Value 2: ” + ite.next().text());
              System.out.println(“Value 3: ” + ite.next().text());
              System.out.println(“Value 4: ” + ite.next().text());
              trs.remove(0);
              for (Element tr : trs) {
                  Elements tds = tr.getElementsByTag(“td”);
                  Element td = tds.first();
                  System.out.println(“Blog: ” + td.text());
              }
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>Please suggest me what exactly changes I need to do in the above code ,so that i get the exact information from the table that I require..Any help will be appreciated..thanx in advance..</p>