Java Html解析来自TD标记的文本
我有我的Html数据Java Html解析来自TD标记的文本,java,android,android-intent,html-parsing,Java,Android,Android Intent,Html Parsing,我有我的Html数据 <table border='0' cellpadding='3' bgcolor="#CCCCCC" class="hostinfo_title2" width='100%' align="center"> <tr align='center' bgcolor="#ffffff"> <td width='26%' class="hostinfo_title3">Ar
<table border='0' cellpadding='3' bgcolor="#CCCCCC" class="hostinfo_title2" width='100%' align="center">
<tr align='center' bgcolor="#ffffff">
<td width='26%' class="hostinfo_title3">Archive Url</td>
</tr>
<tr bgcolor="#ffffff"
<td height="25" align="center">http://www.toradio.com/prgramdetails/20130413_vali_mm.mp3</td>
</tr>
</table>
存档Url
退房。这是一个很好的JAVA HTML解析器
您应该能够通过以下方式实现这一点:
String html = "<YOUR HTML HERE>";
Document doc = Jsoup.parse(html);
Elements tds = doc.select("table.hostinfo_title2").select("td");
String mp3Link = "";
for(Element td : tds) {
if(td.text().contains("mp3") {
mp3Link = td.text();
// do something with mp3Link
}
}
String html=”“;
Document doc=Jsoup.parse(html);
元素tds=doc.select(“table.hostinfo_title2”)。select(“td”);
字符串mp3Link=“”;
用于(元件td:tds){
如果(td.text()包含(“mp3”){
mp3Link=td.text();
//用mp3Link做点什么
}
}