【发布时间】:2016-03-21 02:44:57
【问题描述】:
我需要获取此表中的下载链接:
<table cellpadding="0" cellspacing="3" border="0">
<tr>
<td><img class="img" src="...path" /></td>
<td><a href="the file I want to download">File</a> -
<a id="1569" class="tepLink" href="javascript:void(0);">[Click me]</a>
</td>
</tr>
</table>
这是我尝试过的:
Element table = doc.select("table[cellpadding=\"0\" cellspacing=\"3\" border=\"0\"]").first();
Element dwlLink = table.select("td:has(a)").first();
String absPath = dwlLink.attr("abs:href");
//use download manager to download from string absPath
我总是得到一个“空对象引用”,所以我的代码一定是错的,应该怎么办?
【问题讨论】:
标签: java hyperlink jsoup html-table