- From: <noah_mendelsohn@us.ibm.com>
- Date: Mon, 16 Dec 2002 14:50:05 -0500
- To: sankar s <sankarsb@yahoo.com>
- Cc: xmlschema-dev@w3.org, xmlschema-dev-request@w3.org
Sankar writes: > I need some help in implementing the some validation in > XML schema (xsd files) > > 1. Phone number must be string of 10 chars and first > three chars must be number > > 2. Emai should have "@" and "." in it.(Basic Email validation) Use the pattern facet for both of these. [1,2] > 3. Date should be in "yyyy-mon-dd" format If you really mean a three character month such as "Jan" for the English word January, that's not supported by the schema date type. Quoting from the recommendation [3]: "The lexical representation for date is the reduced (right truncated) lexical representation for dateTime: CCYY-MM-DD. No left truncation is allowed. An optional following time zone qualifier is allowed as for dateTime. To accommodate year values outside the range from 0001 to 9999, additional digits can be added to the left of this representation and a preceding "-" sign is allowed. For example, to indicate May the 31st, 1999, one would write: 1999-05-31. See also ISO 8601 Date and Time Formats (§D)." You can use the pattern facet to restrict this further, but not to introduce any forms that are not legal as documented above. Hope this helps. Noah [1] http://www.w3.org/TR/xmlschema-2/#rf-pattern [2] http://www.w3.org/TR/xmlschema-2/#dt-regex [3] http://www.w3.org/TR/xmlschema-2/#date ------------------------------------------------------------------ Noah Mendelsohn Voice: 1-617-693-4036 IBM Corporation Fax: 1-617-693-8676 One Rogers Street Cambridge, MA 02142 ------------------------------------------------------------------
Received on Monday, 16 December 2002 14:53:05 UTC