i am trying to reed an Rss XML From the Http , i used this tow mathode :
public String getXMLfromUrl(String url){
String xml = null;
try{
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
HttpResponse httpResponse = httpclient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
xml = EntityUtils.toString(httpEntity);
}catch(Exception e){
Log.e(" getXMLfromUrl : "," ",e);
}
return xml;
}
public Document getDomElement(String xml){
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try{
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(xml));
doc = db.parse(xml);
doc.getDocumentElement().normalize();
}catch(Exception e){
Log.e(" getDomElement : "," ",e);
}
return doc;
}
but i have a problem the first mathod dosn't return all the XML String , so the String not a will XML Format , i think my XML Stream is too long or cose i contain /n or may but cose contain Arabic characters , so the second Mathod throw java.net.malformedurlexception protocol not found android , or that what i think ....
pleas help me