Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xs:date schema 1

Status
Not open for further replies.

PeterOcean

Programmer
Mar 26, 2002
27
0
0
CA
I have to define a date in a schema that has the format YYYYMMDD. the element in question can also accept an empty value as well. I have tried the following but that doesn't work, does anyone have any ideas.

Thanks

<xs:simpleType name=&quot;date&quot;>
<xs:restriction base=&quot;xs:string&quot;>
<xs:minLength value=&quot;0&quot;/>
<xs:length value=&quot;8&quot;/>
</xs:restriction>
</xs:simpleType>
 
Try something like this:
Code:
<xs:element name=&quot;MyDate&quot;>
  <xs:simpleType>
    <xs:restriction base=&quot;xs:string&quot;>
      <xs:pattern value=&quot;\d\d\d\d\d\d\d\d&quot;/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>
While I'm sure the date format you listed was given to you as a requirement, you should make an effort to convince them to use the standard XML date format: ISO-8601 See
You can then define your date as xs:date and be done with it.

Chip H.



If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top