Deserialization

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Deserialization

Priyanka Raghavan
Hi,

Could you please let me know how I could solve the problem of not using inbuilt reflection API of Xstream for serialization and deserialization. When I change class attributes or methods after I've serialized a class I have a problem. Please let me know.

Thanks,
Priyanka

Reply | Threaded
Open this post in threaded view
|

RE: Deserialization

Jörg Schaible
Priyanka Raghavan wrote on Sunday, January 22, 2006 2:22 AM:

> Hi,
>
> Could you please let me know how I could solve the problem of
> not using inbuilt reflection API of Xstream for serialization
> and deserialization. When I change class attributes or
> methods after I've serialized a class I have a problem. Please let me
> know.

Then you have to write you're own converters or you must wait until we or someone else implements

http://jira.codehaus.org/browse/XSTR-68
http://jira.codehaus.org/browse/XSTR-210

- Jörg
Reply | Threaded
Open this post in threaded view
|

CDATA

Akshay Shrivastava
Hi,

Thanks again for the wonderful library.  I have a small problem and a
solution.

One of my objects is called 'FormattedText' has a String member called
'content' which is supposed to contain valid XHTML code.  When I serialize
this object, XStream escapes the html tags using < and > etc... but
what I really want is that the serialized attribute should use the CDATA tag
like so:

<FormattedText>
<content>
  <![CDATA[
    <b>my content here.  Any <i>valid</i> XHTML is fine.  No escaping
required.  Absolutely human readable code!!</b>
  ]]>
</content>
</FormattedText>

Now I am thinking if we enhance the default Converter to use CDATA tag
instead of escaping, everyone will be happy (both the XML parsers and humans
reading the code).

I am sure that this is a very small enhancement and I can submit some code
myself, if everyone agrees.

Thanks,
Akshay

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Reply | Threaded
Open this post in threaded view
|

RE: CDATA

Jörg Schaible
Hi Ashkay,

Akshay Shrivastava wrote on Monday, January 23, 2006 5:00 PM:

[snip]

> Now I am thinking if we enhance the default Converter to use
> CDATA tag
> instead of escaping, everyone will be happy (both the XML
> parsers and humans
> reading the code).
>
> I am sure that this is a very small enhancement and I can
> submit some code
> myself, if everyone agrees.

This has nothing to do with the converter, it is the task of the writer. You may just overload the PrettyPrintWriter.writeText to wrap strings in CDATA blocks.

- Jörg
Reply | Threaded
Open this post in threaded view
|

RE: CDATA

Akshay Shrivastava
Hey, thanks for the prompt reply.

Thats good.  The escape sequences are being put in by the Writer, then?  My
concern is - will modifying the writer alone get rid of the escape sequences
(&lt; for < and &gt; for > etc)?




>From: Jörg Schaible <[hidden email]>
>Reply-To: [hidden email]
>To: <[hidden email]>
>Subject: RE: [xstream-user] CDATA
>Date: Mon, 23 Jan 2006 17:10:13 +0100
>
>Hi Ashkay,
>
>Akshay Shrivastava wrote on Monday, January 23, 2006 5:00 PM:
>
>[snip]
>
> > Now I am thinking if we enhance the default Converter to use
> > CDATA tag
> > instead of escaping, everyone will be happy (both the XML
> > parsers and humans
> > reading the code).
> >
> > I am sure that this is a very small enhancement and I can
> > submit some code
> > myself, if everyone agrees.
>
>This has nothing to do with the converter, it is the task of the writer.
>You may just overload the PrettyPrintWriter.writeText to wrap strings in
>CDATA blocks.
>
>- Jörg

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Reply | Threaded
Open this post in threaded view
|

RE: CDATA

Jörg Schaible
In reply to this post by Akshay Shrivastava
Hi Ashkay,

Akshay Shrivastava wrote on Monday, January 23, 2006 7:00 PM:

> Hey, thanks for the prompt reply.
>
> Thats good.  The escape sequences are being put in by the Writer,
> then?  My concern is - will modifying the writer alone get rid of the
> escape sequences (&lt; for < and &gt; for > etc)?

Yes.

- Jörg
Reply | Threaded
Open this post in threaded view
|

Re: Deserialization

Priyanka Raghavan
In reply to this post by Jörg Schaible
Thanks a pile!