title: Parsing values from complex table using JSoup
body: <p>I have a table with the following html:</p>
  
  <pre><code>&lt;TABLE class=data-table cellSpacing=0 cellPadding=0&gt;
    &lt;TBODY&gt;
    &lt;TR&gt;
      &lt;TD colSpan=4&gt;&lt;A id=accounting name=accounting&gt;&lt;/A&gt;
        &lt;H3&gt;Accounting&lt;/H3&gt;&lt;/TD&gt;&lt;/TR&gt;
    &lt;TR&gt;
      &lt;TH class=data-tablehd align=left&gt;FORM NO.&lt;/TH&gt;
      &lt;TH class=data-tablehd align=left&gt;TITLE&lt;/TH&gt;
      &lt;TH class=data-tablehd align=right&gt;Microsoft&lt;/TH&gt;
      &lt;TH class=data-tablehd align=right&gt;Acrobat&lt;/TH&gt;&lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD&gt;&lt;A id=1008ft name=1008ft&gt;SF 1008-FT&lt;/A&gt;&lt;/TD&gt;
      &lt;TD&gt;Work for Others Funding Transfer Between Projects for an Agreement&lt;/TD&gt;
      &lt;TD align=right&gt;&lt;A 
        href="https://someurl1" 
        target=top&gt;MS Word&lt;/A&gt;&lt;/TD&gt;
      &lt;TD align=right&gt;&lt;A 
        href="https://someurl2" 
        target=top&gt;PDF &lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;
  ...
  </code></pre>
  
  <p>I need to parse the <code>&lt;TR&gt;</code> data getting something like</p>
  
  <pre><code>SF 1008-FT, Work for Others ... an Agreement, https://someurl1, https://someurl2
  </code></pre>
  
  <p>I have tried using the following code:</p>
  
  <pre><code>    URL formURL = new URL("http://urlToParse");
      Document doc = Jsoup.parse(formURL, 3000);
  
      Element table = doc.select("TABLE[class = data-table]").first();
      Iterator&lt;Element&gt; ite = table.select("td[colSpan=4]").iterator();
  
      while(ite.next() != null) {
          System.out.println(ite.next().text());
      }
  </code></pre>
  
  <p>However this only returns the "back to Top" and some different headings located throughout the table.</p>
  
  <p>Can someone help me write the correct JSoup code to parse the information I need?</p>