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

GDateBuilder outputs empty string when used without time or timezone

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Version 1.0.3
    • Component/s: None
    • Labels:
      None
    • Environment:
      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.

        Attachments

          Activity

            People

            • Assignee:
              jacobd Jacob Danner
              Reporter:
              colebatchd Dmitri Colebatch
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: