1、利用URL获取网络内容,通过Jsoup.parse(buffer.toString()); 来解析html内容
URL url=new URL("http://hotels.ctrip.com/hotel/taiyuan105#ctm_ref=ctr_hp_sb_lst");
URLConnection connection = url.openConnection();
InputStreamReader inputStream =new InputStreamReader(connection.getInputStream());
BufferedReader reader=new BufferedReader(inputStream);
StringBuffer buffer=new StringBuffer();
String line="";
while((line=reader.readLine())!=null){
buffer.append(line+"
");
}
Document document = Jsoup.parse(buffer.toString());
Element element = document.getElementById("hotel_list");