Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Volley Server XML Request

Tags:

java

android

xml

I am working on an Android App and using Volley library. The response for some of the requests are in XML format. I searched for Android Volley tutorial on how to deal with XML, but can't seem to find.

The only option at this point for me is:

  1. Use StringRequest to get the Server Response as String
  2. Parse String and traverse it?

Here's the source of Volley: https://android.googlesource.com/platform/frameworks/volley/+/43950676303ff68b23a8b469d6a534ccd1e08cfc/src/com/android/volley/toolbox

I don't see any class dealing with XML Objects.

Any other advice. Help???

like image 443
Jack H. Avatar asked Jul 07 '26 20:07

Jack H.


1 Answers

As someone posted in comment, it has been answered here:

Volley library for Android parse xml response?

Volley do not directly provide an XML Object. Your approach of taking the response as String and then inflating to XMLObject is the way I did it.

I made a Class for parsing XML Responses from Server (Combining GsonRequest with Simple). Here's the Class Code Snippet: SimpleXmlRequest

At first it takes the response from Server as String. Then, it uses Simple Serialization tool (http://simple.sourceforge.net/) to inflate the response to XML Object.

like image 160
Alif Avatar answered Jul 09 '26 10:07

Alif



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!