I am using the following code to read the webpage contents:
String website="";
try {
website = URLEncoder.encode(arg0[0],"UTF-8");
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Document doc;
try {
doc = Jsoup.connect(website).get();
Elements el=doc.getElementsByClass("header");
Elements atr= doc.select("p span");
for(Element s:atr)
ss+="\n"+s.text();
text=el.text();
TextView t1=(TextView)findViewById(R.id.titlenews1);
TextView t2=(TextView)findViewById(R.id.body);
t1.setText(text);
t2.setText(ss);
} catch (Exception e) {
// TODO Auto-generated catch block
}
If I place the URL directly in the website="http://www.mcpss.com/?PN='News2'&SubP='DNewsStory'&gn=&NewsID=47318&ShowNav=&StoryGroup=Current"
I am getting the document.
If I pass the URL from parsing the XML file I am not able to get the document (I am getting exception)
How can I do this, there is any URL encoding technique to get the document?