Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: limit a date with XML Schema

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 1/6/2006 7:04:00 PM

Stefan Reiter wrote:

> Hi, I want to limit a date to a minDate and a maxDate -

> I assume it is only possible with "pattern".

Using minInclusive and maxInclusive for example works for me with MSXML 
4 and with Xerces-Java, example schema is

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   version="1.0">

<xs:element name="root">
   <xs:complexType>
     <xs:sequence>
       <xs:element name="date" maxOccurs="unbounded">
         <xs:simpleType>
           <xs:restriction base="xs:date">
             <xs:minInclusive value="2005-01-01" />
             <xs:maxInclusive value="2006-01-01" />
           </xs:restriction>
         </xs:simpleType>
       </xs:element>
     </xs:sequence>
   </xs:complexType>
</xs:element>

</xs:schema>

Example XML document is

<root>

   <date>2005-03-01</date>
   <date>2005-01-01</date>
   <date>2006-01-01</date>

   <date>2007-01-01</date>

</root>

The last date element is flagged by both validators as being invalid.

I am not sure however why <http://www.w3.org/TR/xmlschema-2/#date> does 
not list any possible constraining facets for that date data type.

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent