title: Jsoup select on condition
body: <p>I have the following html table element:</p>
  
  <pre><code>&lt;table class='myTable'&gt;
   &lt;tbody&gt;
     &lt;tr&gt;
      &lt;th&gt;header1&lt;/th&gt;
      &lt;td&gt;data1&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
      &lt;th&gt;header2&lt;/th&gt;
      &lt;td&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th&gt;subheader1&lt;/th&gt;&lt;td&gt;subdata1&lt;/td&gt;&lt;/tr&gt;
                        &lt;tr&gt;&lt;th&gt;subheader2&lt;/th&gt;&lt;td&gt;subdata2&lt;/td&gt;&lt;/tr&gt;
                        &lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
      &lt;th&gt;header3&lt;/th&gt;
      &lt;td&gt;data3&lt;/td&gt;
     &lt;/tr&gt;
     ....
   &lt;tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>How could I select the headers in the table, where those headers's next td element does not contain a table. In the case above, only select header <code>header1</code> and <code>header3</code>.</p>
  
  <p>What I have at the moment is </p>
  
  <pre><code>Elements elements = doc.select("table[class=" + myTable + "]);
  Element table;
  if(elements.size()&gt;0){
    table = elements.get(0);
  }
  else{
    return someMyObj;
  }
  Iterator&lt;Element&gt; ite = table.select("th AND SOME CONDITIONS").iterator();
  while(ite.hasNext()){
       Element header = ite.next();
  }
  </code></pre>