Android JSoup Example

JSoup is really easy to use, look at these exemples from the JSoup cookbook:here

First, You have to connect to the webpage you want to parse using:

Document doc = Jsoup.connect("http://example.com/").get();

Then, you can select page elements using the JSoup selector syntax.

For instance, say you want to select all the content of the div tags with the id attribute set to test, you just have to use:

Elements divs = doc.select("div#test");

to retrieve the divs, then you can iterate on them using:

for (Element div : divs)
    System.out.println(div.text());
}

Leave a Comment