首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

android中jsoup解析html的几个事例

2012-07-27 
android中jsoup解析html的几个例子1.获取百度所有链接的例子(通过ID):?2.获取news.cqu.edu.cn中class为top

android中jsoup解析html的几个例子

1.获取百度所有链接的例子(通过ID):

?2.获取news.cqu.edu.cn中class为topnews 的新闻标题。

Connection.Response res = Jsoup.connect("http://www.jwc.cqu.edu.cn/login.asp").data("username", "000","password", "000").method(Method.POST).execute();Map<String, String> cookies = res.cookies();//如果需要 Document doc1 = res.parse();Connection connection = Jsoup.connect("http://www.jwc.cqu.edu.cn/PlanAndCurriculum/cour_tab_sel_stud.ASP");for (Entry<String, String> cookie : cookies.entrySet()) {connection.cookie(cookie.getKey(), cookie.getValue());}Document doc = connection.get();

?

热点排行