Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-455

XmlBeans DateOrTimeOrDateTime generated from OTA simple type not compliant with W3C standard

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Version 2.3
    • None
    • XmlObject
    • None
    • Windows XP, JDK 1.6

    Description

      The generated type DateOrTimeOrDateTime from OTA simple type DateOrTimeOrDateTimeType (OTA_SimpleTypes.xsd) doesn't accept 24 as a valid value for the hour field.
      W3C XML Schema Part 2: Datatypes Second Edition (ref. http://www.w3.org/TR/xmlschema-2/#dateTime) states that "'24' is permitted if the minutes and seconds represented are zero, and the dateTime value so represented is the first instant of the following day".
      Code below raises an exception: "union value '24:00:00' does not match any members of 'DateOrTimeOrDateTimeType in namespace http://www.opentravel.org/OTA/2003/05'"
      java.util.Calendar calendar = java.util.Calendar.getInstance();
      calendar.set(2000, 1, 1, 24, 0, 0);
      java.text.SimpleDateFormat format= new SimpleDateFormat("kk:mm:ss");
      org.opentravel.www.ota._2003._05.DateOrTimeOrDateTimeType aDate = org.opentravel.www.ota._2003._05.DateOrTimeOrDateTimeType.Factory.newInstance();
      aDate.setStringValue(format.format(calendar.getTime()));

      Full stacktrace:
      org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: union value '24:00:00' does not match any members of 'DateOrTimeOrDateTimeType in namespace http://www.opentravel.org/OTA/2003/05'
      at org.apache.xmlbeans.impl.values.XmlUnionImpl.set_text(XmlUnionImpl.java:154)
      at org.apache.xmlbeans.impl.values.XmlObjectBase.update_from_wscanon_text(XmlObjectBase.java:1135)
      at org.apache.xmlbeans.impl.values.XmlObjectBase.set_String(XmlObjectBase.java:1080)
      at org.apache.xmlbeans.impl.values.XmlObjectBase.set(XmlObjectBase.java:1637)
      at org.apache.xmlbeans.impl.values.XmlObjectBase.setStringValue(XmlObjectBase.java:1533)

      Attachments

        Activity

          People

            Unassigned Unassigned
            yguerro Yoann Guerro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified