jsoup - Get part of HTML table -
i want take contents of table website.
this websites source code:
<tr><td><table width='100%'><tr><td valign='top' width='1px' class='gridviewrow1'><img src='/images/pin.gif'></td><td class='gridviewrow1'><a href='announcements.etc'><b><i>title num 1</i></b></a><div class='smalltext'>username</div><div class='smalltext' style='color:#808080;'>date</div></td></tr></table></td></tr> <tr><td><table width='100%'><tr><td valign='top' width='1px' class='gridviewrow1'><img src='/images/pin.gif'></td><td class='gridviewrow1'><a href='announcements.etc2'><b><i>title num 2</i></b></a><div class='smalltext'>username</div><div class='smalltext' style='color:#808080;'>date</div></td></tr></table></td></tr>
and code
document doc = jsoup.connect(url).get(); elements td = doc.select("td.gridviewrow1"); desc = td.get(0).nextelementsibling().text();
the output is:
title num 1 username date string.
i want title only.
can explain me how title since title doesn't have unique tag?
title marked - select that
... td = doc.select("td.gridviewrow1 > b >i");
table jsoup
No comments:
Post a Comment