I want to parse a table using jsoup. I have tried to get the flight data but without success!
My code is:
try {
doc = Jsoup.connect("a.html").timeout(13 * 1000).get();
Element table = doc.select("table.arrive-depart-table tbody tr").first();
Iterator<Element> iterator = table.select("td").iterator();
Log.d("log", iterator.next().text());
}
and this is the html:
<table class="arrive-depart-table">
<tbody>
<tr>
<td> string 1</td>
<td> string 2</td>
<td> string 3</td>
<td> string 4</td>
<td> string 5</td>
</tr>
<tr>
<td> string 6</td>
...and more
Exception:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'org.jsoup.select.Elements org.jsoup.nodes.Element.select(java.lang.String)' on a null object reference
I am not able to parse the table flight.
Thank you