Details
-
Wish
-
Status: Closed
-
Trivial
-
Resolution: Won't Fix
-
Version 2
-
None
-
None
-
JAVA 1.4
Description
When setting a Calendar on a XmlObject , the TimeZone is added. If the Timezone is not specified, the defaut Timezone (getDefaultTimeZone() ) is set.
Example: I have a dateOfBirth node in my XML. I do this.
myObject.setDateOfBirth( new GregorianCalendar());
then my XML looks like this:
<dateOfBirth>2005-01-04+01:00</dateOfBirth>
If i do this:
Calendar dob = new GregorianCalendar();
dob.setTimeZone(TimeZone.getTimeZone("UTC"));
myObject.setDateOfBirth( dob);
I get this:
<dateOfBirth>2005-01-04Z</dateOfBirth>
If I do this:
Calendar dob = new GregorianCalendar();
dob.setTimeZone(null);
myObject.setDateOfBirth( dob);
I got a null pointer exception.
My problem is how can I do if I do not want the Timezone to be printed in my XML. I know that xs:date specifies that the timezone is optional, but for display reasons I don't want to show it.
Do you have any clue about this problem? What I suggest is to not display Timezone if it is not present.