Parsing A Table In Jsoup (android)
http://www.novaprojecten.nl/roosters/lbl/basis/38/c/c00086.htm i'm trying to parse the table seen there... what i want is to put all the days (the first row) into a ListView. When
Solution 1:
This is horrible HTML you are trying to parse. But you can select the days with JSoup using the correct selector. The complete selector is table tbody tr td table tbody tr td font
but it can be shortened to body > center > table > tbody > tr:lt(1) font
.
Document doc = Jsoup.connect("http://www.novaprojecten.nl/roosters/lbl/basis/38/c/c00086.htm").get();
List<String> days = new ArrayList<String>();
for (Element col: doc.select("body > center > table > tbody > tr:lt(1) font")) {
days.add(col.text());
}
System.out.println(days); // Maandag 17-09, Dinsdag 18-09, Woensdag 19-09...
In order to select contents for each day you will have to parse each row and retrieve only the n-th column.
All this is possible using JSoup, to answer your question. You should take a look at their website and at the Selector documentation, in order to try further things yourself.
Post a Comment for "Parsing A Table In Jsoup (android)"