Parsing the XML Response in an Android Application

*爱你&永不变心* 提交于 2020-01-11 11:22:28

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/3706821/parsing-the-xml-response-in-an-android-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!