Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Mon, 30 Jun 2008 16:31:33 -0500,    group: microsoft.public.xml        back       


xs:dateTime does not accepts ISO 8601 local time   
Hi,

I'm validating a Xml against a schema but I get error validating ISO 8601 
datetime value.

The fragment of the schema is
<xs:attribute name="fecha" use="required">
    <xs:simpleType>
        <xs:restriction base="xs:dateTime">
            <xs:whiteSpace value="collapse"/>
        </xs:restriction>
    </xs:simpleType>
</xs:attribute>

The value that contains the field "fecha" is '2008-06-30T14:52:00'

It is supposed to be a valid ISO 8601 local time but the schema rejects it. 
Only when using '2008-06-30T14:52:00Z' the schema accepts the value. But in 
order to do that I should convert my datetime to UTC which I'm trying to 
avoid.
Is it any way to fix the schema declaration to accept ISO 8601 local 
datetime?

This problem was present when using typed xml data type in Sql Server 2005.

Any hint is welcomed
Thanks in advance
Sammy
date: Mon, 30 Jun 2008 16:31:33 -0500   author:   SammyBar

Re: xs:dateTime does not accepts ISO 8601 local time   
SQL 2005 requires a time offset.  You can replace the Z with your local time 
offset, like -05:00 for Eastern time, like this:

2008-06-30T14:52:00-05:00

Keep in mind that SQL Server "normalizes" xs:dateTime values to Z time, so 
it will literally store the value above as:

2008-06-30T09:52:00Z

This behavior is changed in SQL Server 2008.  One alternative is to create a 
type derived from xs:string that restricts it's content to the desired 
format.

-- 

========
Michael Coles
"Pro SQL Server 2008 XML"
http://www.amazon.com/Pro-SQL-Server-2008-XML/dp/1590599837/


"SammyBar"  wrote in message 
news:%23VOZsiv2IHA.2060@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I'm validating a Xml against a schema but I get error validating ISO 8601 
> datetime value.
>
> The fragment of the schema is
> <xs:attribute name="fecha" use="required">
>    <xs:simpleType>
>        <xs:restriction base="xs:dateTime">
>            <xs:whiteSpace value="collapse"/>
>        </xs:restriction>
>    </xs:simpleType>
> </xs:attribute>
>
> The value that contains the field "fecha" is '2008-06-30T14:52:00'
>
> It is supposed to be a valid ISO 8601 local time but the schema rejects 
> it. Only when using '2008-06-30T14:52:00Z' the schema accepts the value. 
> But in order to do that I should convert my datetime to UTC which I'm 
> trying to avoid.
> Is it any way to fix the schema declaration to accept ISO 8601 local 
> datetime?
>
> This problem was present when using typed xml data type in Sql Server 
> 2005.
>
> Any hint is welcomed
> Thanks in advance
> Sammy
>
date: Mon, 30 Jun 2008 20:26:50 -0400   author:   Michael Coles michaelcoREPLACE_THIS_WITH_AT_SIGNoptonline.net

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us