Re: [Simple-support] value preprocessing before deserialization
Brought to you by:
niallg
|
From: <Nia...@ub...> - 2009-01-19 12:58:35
|
Hi,
I was just about to write how you could wrap all the transforms or even a transformer such that it could intercept the strings before conversion and decode them. But the persister only has access to the Matcher :(. Anyway that is something I can fix later. You can use the org.simpleframework.xml.graph.TreeStrategy, it's the very same as the DefaultStrategy only its public (in 2.0.2). There you can match the class and decode it when deserializing. There are plenty of unit tests and some info in the tutorial that will show you how to do this.
Hope this helps,
Niall
-----Original Message-----
From: Paweł Kierat [mailto:paw...@gm...]
Sent: 19 January 2009 10:58
To: sim...@li...
Subject: [Simple-support] value preprocessing before deserialization
Hi,
I need to (de)serialize a list of java beans to/from XML message. The problem is that all values (i.e. integers, doubles, dates etc.) in each bean are sent as base64-encoded strings, e.g.:
<response>
<person>
<name>[base64-encoded String]</name>
<age>[base64-encoded int]</name>
<birthDate>[base64-encoded date]</birthDate>
...
</person>
</response>
Is there a simple way to decode those beans without holding all their fields as Strings?
I thought of creating a custom transformation, but then I would have to reimplement all the default transforms as they are not exported by the org.simpleframework.xml package (all classes have "package private" scope).
I was also considering a custom strategy, but again - the DefaultStrategy is "package private" too.
Thanks in advance,
Pawel
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
Visit our website at http://www.ubs.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mails are not encrypted and cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender
therefore does not accept liability for any errors or omissions in the
contents of this message which arise as a result of e-mail transmission.
If verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities
or related financial instruments.
UBS Limited is a company registered in England & Wales under company
number 2035362, whose registered office is at 1 Finsbury Avenue,
London, EC2M 2PP, United Kingdom.
UBS AG (London Branch) is registered as a branch of a foreign company
under number BR004507, whose registered office is at
1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
UBS Clearing and Execution Services Limited is a company registered
in England & Wales under company number 03123037, whose registered
office is at 1 Finsbury Avenue, London, EC2M 2PP, United Kingdom.
|