users@jaxb.java.net

Re: TimeZone.MISSING in xsdlib.jar

From: Joe Fialli <Joseph.Fialli_at_Sun.COM>
Date: Wed, 29 Jun 2005 17:25:37 -0400

Vallamshettla, Anand wrote:

> Hi,
>
> All the dates defined in the schema are of type xs:date. But when JAXB
> 1.0 unmarshalls XML file with date value ‘1967-08-13’, it reads it
> with GMT+0 time zone i.e TimeZone.MISSING = JavaMissingTimeZone.
>
There is a mismatch between standard Java calendar datatypes and XML
Schema calendar datatypes.

All Java calendar datatypes MUST have a TimeZone declared. If one is not
defined during creation, the default timezone is assumed.
TimeZone is optional for XML Schema calendar datatypes.

So the TimeZone.MISSING abstraction was added in a later version of JAXB
1.x to
roundtrip the original XML calendar date not having a timezone. Sounds
like you
desire the previous behavior that no time zone in the xml content is
defaulted to the default local time zone.

<jaxb:javaType> customization allows you to override the default binding
between
XML Schema builtin datatypes and Java builtin datatypes. You might also want
to look at javax.xml.datatype.XMLGregorianCalendar. That type was added
to JAXP 1.3 and is used by JAXB 2.0 as the default binding for XML
Schema calendar
datatypes to improve control over the mismatch between Java and XML
Schema calendar datatypes.

-Joe Fialli, Sun Microsystems

> Is there a way to customize JAXB 1.0 such that these dates are
> unmarshalled with another TimeZone?
>
> Thanks,
>
> /*/Anand Vallamshettla/*/
>
> //Texas//// Guatanteed Student Loan//
>
> //Ph: 512 219 5700 x4481//
>