2011-08-09 122 views
0

我正在開發一個android project.i想訪問網頁的某個部分,但我該怎麼做?該解析器適合此任務的最佳選擇以及如何使用此解析器。 我用下面的方法訪問該網頁,但現在要分析此頁面從html頁面解析數據

public void call_a_site() 
    { 
      try 
     {  
      Uri uri = Uri.parse("http://www.dsebd.org/"); 
      startActivity(new Intent(Intent.ACTION_VIEW,uri)); 

     } 

    catch(Exception e) 
    { 

    } 
} 

PLZ幫助.. 感謝

+0

的http://計算器.com/questions/5173538/android-jsoup-example可能會回答你的問題。 – Phil

回答

0

Jsoup庫是HTML解析的最佳選擇。

第1步:下載jsoup.xxxjar download link
第2步:在庫中導入IDE文件夾
第3步:設置爲庫

樣品

 // Connect to the web site 
     Document document = Jsoup.connect(url).get(); 
     // Using Elements to get the Meta data 
     Elements description = document 
        .select("meta[name=description]"); 
     //Locate the content attribute 
      desc = description.attr("content");