I was using Jaxb1.0/jdk1.4 in my application to convert java objects to xml. The date-time used to be output in the format 2008-02-04T15:04:48+00:00.
I upgraded to Jaxb2.0 /jdk1.5 and am getting the output in the format 2008-02-04T15:04:48. ie the timezone information is lost. I tried to do a setTimezone on the xMLGregorianCalendar object but then it returns a format with an Z (eg: 2008-01-22T01:40:00Z) appended. Of course the Z component is equivalent to the +/-aa:bb but unfortunately the other application that uses the generated xml is built to specifically extract the timezone information from the +/-aa:bb component.
Is is possible to specify that the tmz info should be displayed in the format +/-aa:bb rather than Z ?
You may need to consider creating a new class which extends XMLGregorianCalendar which contains the instance of XMLGregorianCalendar which holds the time. Override the toXMLFormat method to alter the zone offset returned and delegate all the other methods to the contained instance. Before marshalling replace the affected XMLGregorianCalendar instances with CustomXMLGregorianCalendar instances.
[ February 04, 2008: Message edited by: Peer Reynders ]