Since I solved my problem, I thought I'd post the solution. It was quite 
simple once I spent a little more time reviewing the Conversions and 
<format> element docs. A simple de/serializer change give me the 
functionality I need. I unmarshall to a calendar where the get/setter 
has code in my to also get/set date and timezone vars.

I was surprised this (de/)serializer wasn't included in the 
org.jibx.runtime.Utility class. I'd think this would be a common 
use-case for anyone using the full functionality of the XSD DateTime 
data type. But perhaps, once again, I simply need to spend more time on 
the docs to understand why.

Jason Ward wrote:
> I'm looking for a little guidance on how to handle some dateTime 
> objects. I have written a custom serializer that ensures my dateTime 
> objects carry the appropriate timezone (and JiBX doesn't convert to 
> UTC). But, I have a need while unmarshalling to retain the timezone 
> info and drop it into another object variable (since java.util.Date 
> objects don't contain TZ info).
>
> The threads I could dig up on this is are all pretty dated, but it 
> sounds like writing my own unmarshaller is in order. However, the 
> HashMap example seems pretty complex ... at least to me since I 
> haven't had to venture into this area... so I'm wondering if anyone 
> has a suggestion for an easier way?
>
> Is it feasible to simply change my unmarshalled type to a 
> GregorianCalendar and handle splitting the date/time from TZ in a 
> post-set, etc.? Or is a customer unmarshaller really the best way to 
> go? I know I can always add another object to the XML to explicitly 
> carry the TZ, but this seems like overkill when dateTime already holds 
> the data.
>
> Any advice is greatly appreciated.
>
>  

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to