public String downloadXML(final String urlStr) { StringBuffer sb=new StringBuffer(); String line=null; BufferedReader buffer=null; try { URL url=new URL(urlStr); HttpURLConnection urlConn=(HttpURLConnection)url.openConnection(); InputStream inputStream = urlConn.getInputStream(); buffer=new BufferedReader(new InputStreamReader(inputStream)); while ((line= buffer.readLine()) != null) { sb.append(line); } } catch (Exception e) { e.printStackTrace(); } finally{ try { buffer.close(); } catch (Exception e2) { e2.printStackTrace(); } } return sb.toString(); }