[英]Why am I getting this warning and how to resolve it "This version only understands SDK XML versions up to 2 but an SDK XML..."
[英]Why am I only getting <?xml version=“1.0” standalone=“no”?> when request for a xml file? Android
我正在使用此方法從遠程服務器獲取xml文件,我使用另一個解析器類對其進行解析,然后成功解析了該文件。 但是,當我使用Log.d("get xml", xml)
檢查xml文件的內容時,它僅在logCat中顯示<?xml version="1.0" standalone="no"?>
。 為什么?
public String getXmlFromUrl(String url) {
String xml = null;
try {
// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
if(httpPost != null){
Log.d("httpPost", "httpPost not null");
}
HttpResponse httpResponse = httpClient.execute(httpPost);
if(httpResponse != null){
Log.d("httpResponse", "httpResponse not null");
}
HttpEntity httpEntity = httpResponse.getEntity();
xml = EntityUtils.toString(httpEntity);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
// return XML
Log.d("get xml", xml);
if(xml!=null){
Log.d("get http client", "get http client not null");
}
return xml;
}
我認為問題不在於請求,而是LogCat中的輸出。 分別記錄每行可獲得所需的完整響應!
因此,通過在調試模式下應用斷點來進行檢查。 可能會為您提供幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.