Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: XML
Expertise: Advanced
Aug 25, 2004



Application Security Testing: An Integral Part of DevOps

Regular Expression Validation in XSD

The following code performs powerful Date type validation in XSD. It validates date fields with timestamp (optional) in yyyyMMdd hh:MM:ss.ffffff format.

If your XML file contains the element ValueDate, the corresponding XSD will be this:

<xs:element name="ValueDate" type="dateType"/>

<xs:simpleType name= "timestampType">
  <xs:restriction base = "xs:string">
   <xs:pattern value='[1-9][0-9][0-9][0-9](([0][1|3|5|7|8])([0][1-9]|[1-2][0-9]|[3][0-1])|([0][4|6|9])
[1])([0][1-9]|[1-2][0-9]|[3][0]))([ ]([2][1-4]|[0][0-9]|[1][0-9])[:]([0-5][0-9]|[6][0])[:]([0-5][0-9]|[6]
Supal Chowdhury
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date