I use a Jsoup to get the Elements from a web:
Elements addresses = doc.select("address > div");
and the result is like this:
<address>
<div>
7135 S Kingery Hwy<br>Willowbrook, IL 60527
</div>
<div class="phone">
(630) 288-6635
</div>
</address>
I have a hard time to retrieve the address from the tag. I use a text() method:
for (Element address : addresses) {
Log.i("addresses", address.text() );
}
and the result is:
7135 S Kingery Hwy Willowbrook, IL 60527
(630) 288-6635
How can I filter it to retrieve the address only and also replace br tag with newline? Expected result:
7135 S Kingery Hwy
Willowbrook, IL 60527
You can try this,