Skip to content Skip to sidebar Skip to footer

How To Parse Web Page In Android

i have a web url http://m.cricbuzz.com/cricket-match/live-scores which page source is

ENG vs PAK, Sydney&l

Solution 1:

JSoup is one such open source library that provides an API for extracting and manipulating data. Basically, it is an HTML parser used for working with various HTML elements, attributes etc. It can also find and extract data, using DOM traversal or CSS selectors.

Stringhtml="<p>An <a href='http://example.com/'><b>example</b></a> link.</p>";
Documentdoc= Jsoup.parse(html);
Elementlink= doc.select("a").first();

Stringtext= doc.body().text(); // "An example link"StringlinkHref= link.attr("href"); // "http://example.com/"StringlinkText= link.text(); // "example""StringlinkOuterH= link.outerHtml(); 
    // "<a href="http://example.com"><b>example</b></a>"StringlinkInnerH= link.html(); // "<b>example</b>"

Visit this it will help you with your problem, with that have a look on cookbook

Solution 2:

You can user use JSOUP. It is an open source library used to parse HTML page. You can give a look here http://jsoup.org/.

If you want to use it in Android you can give a look at my post in my blog where i explain how to use it:

http://www.survivingwithandroid.com/2014/04/parsing-html-in-android-with-jsoup.html

Hope this helps you!

Post a Comment for "How To Parse Web Page In Android"