我正在使用 Jsoup 从表格单元格中提取文本。但我得到null
错误。我想在<p>
每个<td>
. 我该怎么做?
Document doc = Jsoup.connect("URL").get(); //this is where Null error is thrown - but the URL is valid
Element table = doc.select("table").first();
Iterator<Element> iterator = table.select("td").iterator();
while(iterator.hasNext())
{
Log.e("CellText", iterator.next().text());
}
HTML:
<table border="0" cellspacing="0" cellpadding="0" width="400">
<tr>
<td width="100">
<p><strong>Text1</strong></p>
</td>
<td width="200">
<p>Text2</p>
</td>
</tr>
<tr>...