Hi Raymond,
I have created a small demo for representing my problem.
The code:
--------------
public class DemoSdo {
public static void main(String[] args) throws IOException {
HelperContext ctx = HelperProvider.getDefaultContext();
FileInputStream is = new FileInputStream("src/sdo/DemoSDO.xsd");
XSDHelper xsdHelper = ctx.getXSDHelper();
xsdHelper.define(is, null);
DataFactory f = ctx.getDataFactory();
DataObject newDO = f.create("http://DemoSDO/src/sdo", "DemoSDO");
Date d = new Date();
newDO.setDate("timeStamp", d);
newDO.setDate("demoDate", d);
String uri = newDO.getType().getURI();
String name = newDO.getType().getName();
String serializedDO = XMLHelper.INSTANCE.save(newDO, uri, name);
System.out.println(serializedDO);
}
}
The XML schema:
--------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://DemoSDO/src/sdo">
<xsd:complexType name="DemoSDO">
<xsd:sequence>
<xsd:element name="timeStamp" type="xsd:dateTime">
</xsd:element>
<xsd:element name="demoDate" type="xsd:date">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
The output:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<sdo:DemoSDO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sdo="http://DemoSDO/src/sdo" xsi:type="sdo:DemoSDO">
<timeStamp>2008-08-28T10:10:40.366Z</timeStamp>
<demoDate>2008-08-28 UTC</demoDate>
</sdo:DemoSDO>
According to the specification demoDate should be 2008-08-28Z.
Am I right?
Best Regards
Zoltan
2008/8/25 Raymond Feng <[EMAIL PROTECTED]>
> What we produce for xsd:date conforms to the XSD spec, please see:
>
> http://www.w3schools.com/Schema/schema_dtypes_date.asp
>
> Thanks,
> Raymond
>
>
> From: Zoli Borsos
> Sent: Monday, August 25, 2008 6:00 AM
> To: [email protected]
> Subject: xs:Date output not compliant with spec
>
>
>
> Hello,
>
> I have found some deviation from the XML spec. when I use
> XMLHelper.INSTANCE.save.
> The problem occurs when I want to print Date (xs:Date).
> It looks e.g.: 2008-07-11 UTC
> Instead of: 2008-07-11Z.
>
> Can anybody confirm if this is a bug?
>
> I debugged the source code and found a pattern at line 453:
> SDOSimpleDateFormat f = new SDOSimpleDateFormat("yyyy-MM-dd zz");
> in the method:
> public synchronized String toYearMonthDay(Date date)
>
> I also found similar patterns in other methods too.
> The can be bugs too?
>
> If they are bugs open please a Jira issue!
>
> Thanks and
> Best Regards
> Zoltan
>