Reputation: 1252
I am trying to parse html from this url http://skyalipi.blogspot.com/2011/04/there-is-no-resistance-without.html using jSoup. I am using this code
Document doc = Jsoup.parse("http://skyalipi.blogspot.com/2011/04/there-is-no-resistance-without.html");
Log.d("test", "the elements"+doc);
In the log, I am getting the following
05-26 12:05:05.355: DEBUG/test(696): the elements<html>
05-26 12:05:05.355: DEBUG/test(696): <head></head>
05-26 12:05:05.355: DEBUG/test(696): <body>
05-26 12:05:05.355: DEBUG/test(696): http://skyalipi.blogspot.com/2011/04/there-is-no-resistance-without.html
05-26 12:05:05.355: DEBUG/test(696): </body>
05-26 12:05:05.355: DEBUG/test(696): </html>
I Want to get the paragraph contents. I dont know where I am going wrong. I refered to the following url too http://jsoup.org/cookbook/extracting-data/attributes-text-html Please help
Upvotes: 1
Views: 2175
Reputation: 10918
Jsoup is treating your URL as if it is the text that you want to parse, and is converting it into valid HTML so that it can be parsed. I think you want to connect to the site and retrieve the content at that url, then parse the result:
Document doc = Jsoup.connect("http://skyalipi.blogspot.com/2011/04/there-is-no-resistance-without.html").get();
EDIT
Have a look at the documentation for examples. You can do things like:
Element example = doc.getElementById("alternatives1");
Log.d("test","example "+example.text());
Upvotes: 1