dingjun
dingjun

Reputation: 94

A strange valid value for xsd:dateTime

I use the type xsd:dateTime for a long time und faced today a node of this type with this value

-292269055-12-02T17:47:04.192+01:00

, which I thought it was not a valid value, but when I use XML Spy 2017 to validate the value, it telle me, that it is valid.

Can someone explain me, why this value is valid or if it is a wrong implementation of XSD validation in XML Spy?

Thanks!

Dingjun

Upvotes: 0

Views: 645

Answers (1)

fvu
fvu

Reputation: 32973

It looks strange, but it seems legal: quoting from https://www.w3.org/TR/xmlschema-2/#dateTime 3.2.7.1

The ·lexical space· of dateTime consists of finite-length sequences of characters of the form: '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?, where

  • '-'? yyyy is a four-or-more digit optionally negative-signed numeral that represents the year; if more than four digits, leading zeros are prohibited, and '0000' is prohibited (see the Note above (§3.2.7); also note that a plus sign is not permitted);

So yes, a year can be negative and can be longer than 4 digits.

Upvotes: 1

Related Questions