parsing data from html page
I am developing an android project.i want to access some portion of a webpage but how can i do so? which parser suits the best for this task and also how 开发者_开发技巧to use this parser. i use the following method to access the webpage but now want to parse this page
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 help.. thanks
Check out the JSoup cookbook.
http://jsoup.org/cookbook/
This has a lot of good information in it and should be able to answer most of your questions.
You are probably looking for something along the lines of this: http://jsoup.org/cookbook/input/parse-body-fragment
Jsoup library is the best option for Html parse.
Step 1: Download jsoup.x.x.x.jar download link
Step 2: Import in libs folder in IDE
Step 3: Set as library
Sample
// 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");
精彩评论