Announcement Announcement Module
Collapse
No announcement yet.
XMLGregorianCalendar versus java.util.Date Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XMLGregorianCalendar versus java.util.Date

    I was ignorant of the XMLGregorianCalendar type until I saw it in the Spring WS Axis client for the airline sample. I was surprised to see this touted as a "standard".

    How can it be that when there are several calendars in use around the world that XML can standardize on Gregorian in this way? They've gone to great pains to make XML support Unicode. Why just one calendar and one standard date format?

    I'm working on apps for international offices these days, so I've become more aware of I18N than I would have thought possible. Still lots to learn, though.

    %

  • #2
    XMLGregorianCalendar is based on representing time as specified in ISO8601. They had to pick one representation of dates and times in XML and that was the one they chose. Localisation issues (such as converting from ISO8601 to local calendar) should be handled by the application not the data interchange format.

    Comment


    • #3
      <rant>
      Dates and calendars are a pain in Java. So until we get JSR 310, I would suggest using the excellent Joda Time for all your date & time handling.

      The only reason I don't use it by default in Spring-WS is that it's an extra dependency, and I don't want to require it.
      </rant>

      Comment


      • #4
        Thank you, Arjen. Your advice and the web services module are both most welcome.

        %

        Comment

        Working...
        X