我想解析使用SAX解析器我的应用程序的XML响应,我不知道该怎么做,所以任何人都可以请giude我在正确的道路。
用少许编码或一个链接的一个例子将是确定。 谢谢, 大卫
解决方案 尝试{
HttpClient的客户端=新DefaultHttpClient();
串的getURL =&其中; URL取代;
HTTPGET GET =新HTTPGET(的getURL);
HTT presponse responseGet = client.execute(获得);
mResEntityGet = responseGet.getEntity();
如果(mResEntityGet!= NULL){
//做一些与响应
内容= EntityUtils.toString(mResEntityGet);
}
}赶上(例外五){
e.printStackTrace();
}
内容将是XML格式的字符串,使用XML拉式解析器解析它。
I want to Parse the XML Response in my Application using a SAX PArser, I don't know how to do that, So Can anybody please giude me to the right path.
An example with a little coding or a link will be OK. Thanks, david
解决方案try {
HttpClient client = new DefaultHttpClient();
String getURL = <URL>;
HttpGet get = new HttpGet(getURL);
HttpResponse responseGet = client.execute(get);
mResEntityGet = responseGet.getEntity();
if (mResEntityGet != null) {
//do something with the response
content = EntityUtils.toString(mResEntityGet);
}
} catch (Exception e) {
e.printStackTrace();
}
"content" will be the string of XML format, parse it using XML pull parser.