Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Date validating regexp in pattern facet yields invalid results?

From: "Johann Sijpkes" <jsijpkes@-------.-->
To: xmlschema-dev@--.---
Date: 7/14/2004 1:32:00 AM
Hi,

I want to validate dates using a schema but somehow the regexp used to do this 
is not performed by the validator?

I have a small regular expression which works fine, but the long beast just
validates, also on invalid dates like 35/07/04 (dd/mm/yy). Anyway, in the
online regexp tester it works fine ? (And I believe it is a rather popula regexp to 
validate dates..)
I have no idea why this is.. The other restrictions trigger OK.
Is the expression too long? If so, is there a workaround?

Thanks,
Johann

This is the code:

<xsd:simpleType name="date_type" >
<xsd:restriction base="xsd:string">
<xsd:minLength value="8" />
<xsd:maxLength value="8" />
<xsd:pattern value="^\d{2,2}/\d{2,2}/\d{2,2}$" /> <!-- This regexp
works, the next does not -->

<xsd:pattern value=
"^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/(\d{2}))|((0[1-9]|[12]\d|30)\/(
0[13456789]|1[012])\/(\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/(\d{2}))|(29\/02\/((
0[48]|[2468][048]|[13579][26])|(00))))$" />
</xsd:restriction>
</xsd:simpleType>

<!-- Credits for the regular expression go to Dany Lauener who posted this
on the regexp library
http://www.regexlib.com/REDetails.aspx?regexp_id=488

Regular expressions can be tested at :
http://www.regexlib.com/RETester.aspx

The test file is available at 
http://student.kitcampus.com/Projects/group94/stud15/pl_test_schema_fail.xml

Thanks again,
Johann



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