views:

38

answers:

1

I am working on an Android application that is required to connect to a REST WebService. There are a number of requests that the application needs to make and the request format is XML. What I have done presently is create a Request template per XML request using StringBuilder class and substitute a placeholder String for different values that need to be passed at Runtime.

For instance:

StringBuilder TEMPLATE = new StringBuilder("<GetStatusReq><item>@itemid@</item></GetStatusReq>");

The request XMLs contain about 20-30 nodes with some of them containing attributes. So you can imagine the complexity.

Is this the correct way to handle such a case? Or Should I be using XMLSerializer(need a link to good tutorial)?

What is the ideal way to handle such cases?

Please help.

Thanks.

+2  A: 

I would suggest using xstream for marshaling and unmarshaling the xml. It is light weight and has small memory footprint.

Teja Kantamneni
how about the XML Serializer bundled with the Android SDK?
Samuh