g8214435
g8214435

Reputation: 737

Parsing table html using JSoup

Sorry for my english. I use jsop libruary and i try parsing data from table. But i have not good result. I have this html:

<table class="charTable">
<tr>
<th><a href="processor.html">№</a></th>
<th><a href="processor_model.html" >Модель</a></th>
</tr>
<tr valign=top  style="background-color:#FFFFFF">
<td><nobr><input type="checkbox" name="887" class="compare_check">1</nobr></td>
<td><nobr><b><a href="./processor_887.html">Intel Core i7-4940MX (Haswell)</a></b></nobr></td><td>3100</td>
</tr>
<tr>.....</tr>
<tr>.....</tr>
<tr>.....</tr>
<tr>.....</tr>
</table >

I need take this string:

Intel Core i7-4940MX (Haswell)

I do like this:

Elements text = doc.select("tbody > tr > td > nobr > b > a");

And he output me

<a href="./processor_887.html">Intel Core i7-4940MX (Haswell)</a>

Upvotes: 0

Views: 57

Answers (1)

Tim
Tim

Reputation: 1174

use the text() method of the Element class to grab the node value text.

e.g. for (Element e: text) { System.out.println(e.text()); }

Upvotes: 1

Related Questions