rlalfo / google-http-java-client

Automatically exported from code.google.com/p/google-http-java-client
0 stars 0 forks source link

XML Generator #171

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello all,

I am currently including google http java client into RoboSpice : 
https://github.com/octo-online/robospice.

RoboSpice is a library that makes it easy to execute network requests inside an 
Android Service, which is a good practice on Android. (more details in the 
GitHub repo's README).

In RoboSpice, we provide automatic caching of network related POJOs : the POJOs 
used as requests results are saved automatically in cache. For this, we just 
reuse the network serialisation/deserialisation code and save the result to a 
file. 

It has been easy to include all json processing of Google Http Java Client in 
RoboSpice. And thanks for the work of making Jackson, Jackson2 and Gson work in 
a homogenous way. It's really a very nice idea and implementation. 

We can see that you are pretty close to achieving the same thing using Xml. 
Nevertheless, there is no Xml generator class in Google Http Java Client, only 
a parser. Thus we can't save the results to disk, only read it. Would it be 
possible and useful for Google Http Java Client to provide a generator, in the 
same way as you do it for Json ?

Thanks in advance,
 Stéphane NICOLAS

Original issue reported on code.google.com by steff.ni...@gmail.com on 2 Dec 2012 at 8:21

GoogleCodeExporter commented 9 years ago

Original comment by ngmic...@google.com on 20 Feb 2013 at 3:21

GoogleCodeExporter commented 9 years ago
Yes there is.  Depending on your use case:

Call the serialize methods in XmlNamespaceDictionary:
http://javadoc.google-http-java-client.googlecode.com/hg/1.13.1-beta/com/google/
api/client/xml/XmlNamespaceDictionary.html

Or use XmlHttpContent:
http://javadoc.google-http-java-client.googlecode.com/hg/1.13.1-beta/com/google/
api/client/http/xml/XmlHttpContent.html

Good luck!

Original comment by yan...@google.com on 20 Feb 2013 at 3:30