- From: Eddie Robertsson <erobertsson@allette.com.au>
- Date: Thu, 16 May 2002 10:24:26 +1000
- To: Cool Santos <mogot2002@yahoo.fr>
- CC: xmlschema-dev@w3.org
Hi Cool,
> Has someone an idea, how man could define "calendar
> week" with the following syntax: WW.JJJJ (WW
> represents the calendar week and JJJJ the year) in a
> XML Schema? There is data type "date", "time", but not
> "week"!
>
> Example:
>
> 20.2002 represents the 20.week im year 2002
>
> I hope, there is only 52 weeks in a year (52*7
> days=364 days. A year is maximal 365 days).
There is no defined datatype in XML Schema that let's you do this but
you can fairly easy create one using the pattern facet. I think
something like this would be sufficient:
<xs:simpleType name="WeekYear">
<xs:restriction base="xs:string">
<xs:pattern value="(([0-4][0-9])|5[0-2])\d{4}"/>
</xs:restriction>
</xs:simpleType>
Note that I haven't put any restriction on the year part of the datatype
more than it must contain 4 digits (\d{4}). If you want you can put more
restriction on this.
Cheers,
/Eddie
Received on Wednesday, 15 May 2002 20:11:09 UTC