ITeye博客

jsoup的使用

liuna2011 · 2012-07-18 14:39 · jsoup · 编程语言 · Markdown


        Document doc = Jsoup.parse(responseString);
        Element content = doc.select("a[href=/478210740_tianjishuma.html]").first().firstElementSibling();

        if (content != null) {
            String tmgnum = content.text();
            System.out.println(tmgnum);
        }


rString = rString.replace("积分:","num");
rString = rString.replace("分","");
Document doc = Jsoup.parse(rString);
Element content = doc.select("td:contains(num)").first();
if (content != null) {
    String count = content.text().substring(3);
    user.setOnline(count);
}

Element email = doc.select("font[color=green]").first();
if(email!=null){
   user.setValidate(email.text());}
   return user;
}


Element content2 = doc.getElementById("Top1_lblStates");
Element content5 = doc.select("#Top1_lblSurCount a").first();

参考: http://www.iteye.com/topic/1010582 http://www.ibm.com/developerworks/cn/java/j-lo-jsouphtml/

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。