Note that there are some explanatory texts on larger screens.

plurals
  1. POExtract HTML Table ( span ) tags using Jsoup in Java
    primarykey
    data
    text
    <p>I am trying to extract the td name and the span class. In the sample code, I want to extract the a href with in the first td "accessory" and the span tag in the second td.</p> <p>I want to print Mouse, is-present, yes KeyBoard, No Dual-Monitor, is-present, Yes</p> <p>When I use the below Java code, I get, Mouse Yes Keyboard No Dual-Monitor Yes.</p> <p><strong>How do I get the span class name?</strong> </p> <blockquote> <p><strong>HTML Code</strong></p> </blockquote> <p> </p> <pre><code>&lt;tr&gt; &lt;td class="" width="1%" style="padding:0px;"&gt; &lt;/td&gt; &lt;td class=""&gt; &lt;a href="/accessory"&gt;Mouse&lt;/a&gt; &lt;/td&gt; &lt;td class="tright "&gt; &lt;span class='is_present'&gt;Yes&lt;/span&gt;&lt;br/&gt; &lt;/td&gt; &lt;td class="tright "&gt; &amp;nbsp;&lt;br/&gt; &lt;/td&gt; </code></pre> <p> </p> <pre><code>&lt;tr&gt; &lt;td class="" width="1%" style="padding:0px;"&gt; &lt;/td&gt; &lt;td class=""&gt; &lt;a href="/accessory"&gt; KeyBoard&lt;/a&gt; &lt;/td&gt; &lt;td colspan="2" class="" style='text-align:center;'&gt; &lt;small&gt;No&lt;/small&gt; &lt;/td&gt; </code></pre> <p> </p> <p> </p> <pre><code> &lt;td class="" width="1%" style="padding:0px;"&gt; &lt;/td&gt; &lt;td class=""&gt; &lt;a href="/accessory"&gt;Dual-Monitor&lt;/a&gt; &lt;/td&gt; &lt;td class="tright "&gt; &lt;span class='is_present'&gt;Yes&lt;/span&gt;&lt;br/&gt; &lt;/td&gt; &lt;td class="tright "&gt; &amp;nbsp;&lt;br/&gt; &lt;/td&gt; </code></pre> <p> <blockquote> <p><strong>Java code</strong></p> </blockquote> <p>private void printParse(String HTMLdata){</p> <pre><code>Element table = data.select("table[class="computer_table").first(); Iterator&lt;Element&gt; ite = table.select("td").iterator(); while(ite.hasnext()){ sysout(ite.next().text()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload