当前位置:编程学习 > wap >>

android端pull解析xml格式string对象报错,求解!!



//服务器端servlet发送xml格式的字符串result
String result = baseResBO.getclassifyresource(grade, subject, type, term);//返回一个xml格式字符串
response.getWriter().print(result);

//Android端
String result = null;
HttpPost httpRequest = new HttpPost(BASE_RES_URL);
try {
httpRequest.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
try {
HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequest);
result = EntityUtils.toString(httpResponse.getEntity(),HTTP.UTF_8);
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
        e.printStackTrace();
}
return result;
返回的result字符串输出来xml格式都没问题,但用pull解析就报错了
Error parsing document. (position:line -1, column -1) caused by: org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: not well-formed (invalid token); android servlet xml --------------------编程问答-------------------- 返回的xml格式有问题,自己看一下xml是不是多了什么特殊的字符
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,