xml equivalent of gson?

3,127 views
Skip to first unread message

orange80

unread,
Mar 31, 2009, 8:56:06 PM3/31/09
to google-gson
Hi, Everyone!

Gson is very nice, so big thank you to the developers who have worked
hard to bring us this great tool. I have really found gson suits my
needs well with respect to deserializing from json.

I'm looking for a similar too for Java to/from XML conversion. I have
heard XStream is good and sounds like it works in a way similar to
gson. Is this the best bet?
What are you guys using?

I like XOM to use sometime when I want to manipulate the tree myself,
but would also like to find a good tool for a more automated tool as
well.

Thanks!
Jamie

inder

unread,
Mar 31, 2009, 9:07:40 PM3/31/09
to google-gson
Thanks for the appreciation! If you use Gson in a project that we can
list on our site, drop us a note.

In Gson 1.4, we plan to open up the API to allow returning a Json
Parse Tree from an object. You will be then be able to write it out as
XML.
In Gson 1.3, we already provide a fromJson method that takes a parse
tree of JsonElements and converts it to an object. If you can somehow
parse an XML document to that tree, you can use it to deserialize XML.
The main problem there is that it will only work for a subset of XML
that maps to a tree. General XML allows arbitrary graph
representations, and those will not work nicely with Gson.

Inder
Reply all
Reply to author
Forward
0 new messages