|
Replies:
1
-
Last Post:
Nov 18, 2008 5:59 PM
by: Clive Brettingh...
|
|
|
|
|
|
|
Can XJC set time zone?
Posted:
Nov 18, 2008 2:02 PM
|
|
|
I am using xjc to compile a schema. However, there is a problem for a date type. In the schema, I have one element whose type is date. When I validate a xml file and get the element, I find that the date is wrong. For example, I have following <BeginDate>2008-11-15</BeginDate> When I get this BeginDate and print out the date, it is 2008-11-14.
I figured it out this is due to the timeZone is GMT default. Is there any way we can set the time zone when we do the schema compilation?
|
|
|
|
|
|
|
Re: Can XJC set time zone?
Posted:
Nov 18, 2008 5:59 PM
in response to: zhb402
|
|
|
XML Dates are pretty complex - in this case the value you have represents a non-zoned date.
By default in XJC xml date types are mapped to XMLGregorianCalendar which is capable of representing unzoned values; if you use the methods on this to convert to a GregorianCalendar then it will use the supplied zone, or the default zone for the JVM.
If it is not being mapped to XMLGregorianCalendar then you are using type mapping and it should be possible to handle the zone detail there. If using DatatypeConverter (possibly implicitly) then I dont know the Zone conventions but I would expect the JVM default again (java.util.TimeZone.getDefault()).
Note that the zone default is being applied in runtime when unmarshalling, not compile time (XJC).
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net For additional commands, e-mail: users-help@metro.dev.java.net
|
|
|
|
|