W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2003

Re: Looking for the flexibility of having conditional section in Xml Schema

From: <noah_mendelsohn@us.ibm.com>
Date: Mon, 13 Oct 2003 12:14:54 -0400
To: "Naheed, Kunnummal" <Kunnummal.Naheed@il.proquest.com>
Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Message-ID: <OF16EAB014.6CF568DA-ON85256DBE.00585DF0@lotus.com>

 Kunnummal.Naheed writes (I hope I have gotten your name in the 
appropriate order, if not my sincere apologies!):

>> I have got a requirement in which I need to have a specific 
>> structure for particular value on an element. 

It would be helpful if you could clarify what you mean by "structure for 
value on an element".  There are at least two sorts of values for which 
schema can constrain the form.  If your element is of simple type, then 
you can use the Pattern facet [1,2,3], which allows you to use regular 
expressions to constrain the characters in the value.  For example 
(warning, I'm not a regex expert), I believe the following pattern:


would give you integer forms with no leading sign, and at least one 
redundant zero at the beginning. 

Of course, you can also constrain the element structure of a parent 
element using sequence, choice, and the like.  I hope this is helpful.


[1] http://www.w3.org/TR/xmlschema-0/#ref9
[2] http://www.w3.org/TR/xmlschema-0/#regexAppendix
[3] http://www.w3.org/TR/xmlschema-2/#dt-pattern
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
Received on Monday, 13 October 2003 12:15:30 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:09:01 UTC