Android的Volley库解析xml响应? [英] Volley library for Android parse xml response?

查看:115
本文介绍了Android的Volley库解析xml响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用volley库并以XML格式获取响应.我想知道我们如何使用/volley库来解析响应.谢谢.

I am using volley library and getting response in XML.I want to know how we can parse response using /volley library.Thank you.

推荐答案

    StringRequest req = new StringRequest(Request.Method.GET, url, 
    new Response.Listener<String>() 
    {
        @Override
        public void onResponse(String response) {
            processData(response);
        }
    }, 
    new Response.ErrorListener() 
    {
         @Override
         public void onErrorResponse(VolleyError error) {                                
         // handle error response
       }
    }
);

在processdata方法中解析响应.使用简单的sax解析器或dom解析器解析响应字符串.

in processdata method parse the response.Use simple sax parser or dom parser to parse the response string.

这篇关于Android的Volley库解析xml响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆