Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Version 1.0.3
-
None
-
None
-
Windows XP, JRockit 1.4.1.
Description
See http://issues.apache.org/eyebrowse/BrowseList?listName=user@xmlbeans.apache.org&by=thread&from=896554 for a discussion.
To summarize, the following schema:
<xsd:schema
targetNamespace="urn:test-date-attribute"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="urn:test-date-attribute" elementFormDefault="qualified"
attributeFormDefault="unqualified" version="1">
<xsd:simpleType name="Date">
<xsd:restriction base="xsd:date">
<xsd:minInclusive value="1970-01-01"/>
<xsd:maxInclusive value="2049-12-31"/>
<xsd:pattern value="\d\d\d\d-\d\d-\d\d"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="TestElementWithDateAttribute">
<xsd:complexType>
<xsd:attribute name="SomeDate" type="Date" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
compiled using 1.03, and the following code:
GDateBuilder gdateBuilder = new
GDateBuilder(Calendar.getInstance());
gdateBuilder.clearTime();
gdateBuilder.clearTimeZone();
GDate gdate = gdateBuilder.toGDate();
Date xdate = Date.Factory.newInstance();
xdate.setGDateValue(gdate);
TestElementWithDateAttributeDocument doc = TestElementWithDateAttributeDocument.Factory.newInstance();
TestElementWithDateAttributeDocument.TestElementWithDateAttribute
root =
doc.addNewTestElementWithDateAttribute();
root.xsetSomeDate(xdate);
System.out.println("Doc: " + doc);
spits out:
Doc: <TestElementWithDateAttribute SomeDate=""
xmlns="urn:test-date-attribute"/>
Cezar said this is a bug in 1.03 but works in the version 2 releases.