i m trying to develop a College Updates android app using JSOUP API and parsing content from college website . How can i parse ul, li tags and display them .
sample
First you need to close all spans.
Here's a short example:
String html;
html = "<div class=\"moduletable_events\">";
html += "<ul>";
html += "<li class=\"_mce_tagged_br\"><span style=\"line-height: 1.4em;\"><span style=\"line-height: 1.4em;\">M.Tech Exam Ian-2014 TimeTable 1</span></span></li>";
html += "<li class=\"_mce_tagged_br\"><span style=\"line-height: 1.4em;\"><span style=\"line-height: 1.4em;\">M.Tech Exam Feb-2014 TimeTable 2</span></span></li>";
html += "</ul>";
html += "</div>";
//Document doc = Jsoup.connect("http://example.com/").get(); to load from url
Document doc = Jsoup.parse(html);
Elements div = doc.select("div.moduletable_events"); // select your div with yor class
Elements ul = doc.select("div.moduletable_events > ul");
Elements li = ul.select("li"); // select all li from ul
for (int i = 0; i < li.size(); i++) {
Log.d("jsoup", " " + li.get(i).select("span > span").text());
}
Log.d("jsoup", "size: " + li.size());