XmlBeans DateOrTimeOrDateTime generated from OTA simple type not compliant with
W3C standard
--------------------------------------------------------------------------------------------
Key: XMLBEANS-455
URL: https://issues.apache.org/jira/browse/XMLBEANS-455
Project: XMLBeans
Issue Type: Bug
Components: XmlObject
Affects Versions: Version 2.3
Environment: Windows XP, JDK 1.6
Reporter: Yoann Guerro
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)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]