You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Zoli Borsos <cz...@gmail.com> on 2008/10/30 14:58:55 UTC

Re: xs:Date output not compliant with spec

Hi Raymond,

I created an issue (TUSCANY-2571) short after this message but till now it
is unassigned.
Can you tell me when will be assigned, which release or patch will contains?

Best Regards
Zoltan

2008/8/28 Raymond Feng <en...@gmail.com>

> Sorry, I misread your previous message. It does look like a bug. Would you
> please open a JIRA to track this:
>
> https://issues.apache.org/jira/browse/TUSCANY
>
> Thanks,
> Raymond
>
> From: Zoli Borsos
> Sent: Thursday, August 28, 2008 3:12 AM
> To: user@tuscany.apache.org
> Subject: Re: xs:Date output not compliant with spec
>
>
>
> 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 <en...@gmail.com>
>
> 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: user@tuscany.apache.org
> 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
>