I'm parsing html of a website with JSoup
. I want to parse this part:
<td class="lastpost">
This is a text 1<br>
<a href="post/13594">Website Page - 1</a>
</td>
I want like this:
String text = "This is a text 1";
String textNo = "Website Page - 1";
String link = "post/13594";
How can I get the parts like this?
Your code would only get all the text that is in the
td
elements that you are selecting. If you want to store the text in separate variables, you should grab the parts separately like the following code. Extra comments added so you can understand how/why it is getting each piece.