XML Serialization/Deserialization

94 views
Skip to first unread message

abp

unread,
Jul 21, 2010, 5:39:56 PM7/21/10
to google-guice
Hello,

is there an easy way to store objects in xml and later, load the xml
into an object again?
I think the main problem here is that most xml serializers like
XStream or simple xml inject the object graph on theirselves.
I'am not really sure if something like a translator of object
creations will really help, because i don't know enough about either
guice and
XML serializers. I don't know for example, how a xml deserialization
process or guice should know, that a instance created as member
of one object is the same instance as created for another member of
another object previously.

Any help or suggestions, please?
Thanks in advance.

Alen Vrečko

unread,
Jul 22, 2010, 6:59:20 AM7/22/10
to google-guice
Hi,

maybe some previous discussions such as

http://groups.google.com/group/google-guice/browse_thread/thread/4799571cdc389f55

might give you some ideas. Try searching the group for "serialization"
for more.

Cheers
Alen

abp

unread,
Jul 22, 2010, 7:26:10 AM7/22/10
to google-guice
Oh, I've searched a lot.
Search results are massively screwed by hibernate, javaee,
spring(persistence.XML, web.XML etc).

I will read the linked discussion later. But after a fast scan throug
I think again, aren't there any helpers for this?
Or, at least, a detailed explanation of the patterns to use?

Another problem is that i'm not in a web or hibernate persistence
context (and have zero experience with),
so refernences to "spring does this with xxx" or "hibernate xxx does
that" to describe approaches doesn't help me.

I just want to write an object graph to xml(optimally without CGLIB
generated things) and load/rebuild the object graph with guice.

On 22 Jul., 12:59, Alen Vrečko <alen_vre...@yahoo.com> wrote:
> Hi,
>
> maybe some previous discussions such as
>
> http://groups.google.com/group/google-guice/browse_thread/thread/4799...

Alen Vrečko

unread,
Jul 22, 2010, 9:33:47 AM7/22/10
to google-guice
Use XStream(it supports full object graph) or whatever you like to
serialize the graph to xml.

You cannot use Guice to deserialize. You need to use XStream again.

What Guice can do is inject again the dependencies using
Injector#injectMembers (usually on the fields you don't want
serialized - marked transient).

abp

unread,
Jul 22, 2010, 11:29:00 AM7/22/10
to google-guice
Yeah, basically i know how XStream works. Then i will try to build a
XStream converter
that does what i want?

Problem is, at the moment i serialize everything (like
oXStream.toXML(oGraphRoot)).
Thats pretty comfortable. Also i must serialize the guice injected
fields, because without
them i have no graph at all, not? (object references in the graph are
injected by guice)

But i could try injecting members with guice and then fill in data-
fields(Strings, BigDecimals etc.)
via XStream, if that is possible.

usrecru...@gmail.com

unread,
Jul 10, 2018, 6:05:41 PM7/10/18
to google-guice
Hi All, 

I need a project manager SERIALIZATION for my client, let me know if you have someone.. 

Manjeet Singh
IT Solutions Inc, 
Reply all
Reply to author
Forward
0 new messages