users@jaxb.java.net

Re: xsd:date with finer resolution

From: Christopher Piggott <cpiggott_at_gmail.com>
Date: Mon, 29 Jun 2009 11:37:20 -0400

Perhaps because I did not read long enough. I looked up the format of
xsd:dateTime and found this:

    [-]CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]

and interpreted that to mean no milliseconds. When I read your
message I looked again, here:

    http://books.xmlschemata.org/relaxng/ch19-77049.html

and noticed this in their examples section:

    2001-10-26T21:32:52.12679.

I missed that the first time.

Seems like this is a conflict (the format vs. the example) and I need
to find an authoritative source, or just try it. I will do that now.
Thanks for pointing me in the right direction.

--Chris

On Mon, Jun 29, 2009 at 4:22 AM, Wolfgang Laun<wolfgang.laun_at_gmail.com> wrote:
> Why can't you use xsd:dateTime and its (default) binding to
> XMLGregorianCalendar?
> -W
>
> On Sun, Jun 28, 2009 at 6:48 AM, Christopher Piggott <cpiggott_at_gmail.com>
> wrote:
>>
>> Hi,
>>
>> I want to map xsd:date to a java.util.Date but I want to do it with
>> millisecond resolution.  What are my best options for doing this?
>> This is for a jersey application so having my own custom parse/print
>> class isn't a great option.  My first attempt was this:
>>
>>            <xsd:element name="timestamp" type="xsd:date">
>>                <xsd:annotation>
>>                    <xsd:appinfo>
>>                        <jaxb:javaType
>>                            name="java.util.Date"
>>                            xmlType="xsd:date"
>>
>> printMethod="javax.xml.bind.DatatypeConverter.printDate"
>>
>> parseMethod="javax.xml.bind.DatatypeConverter.parseDate"/>
>>                    </xsd:appinfo>
>>                </xsd:annotation>
>>            </xsd:element>
>>
>> It didn't work out so well.  I suppose I could just use a long, but I
>> was hoping to have a little bit stronger typing than that.  Basically,
>> all I need is a date/time but with msec resolution.
>>
>> --Chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>
>