Re: combining enumeration and pattern

"Simon Cox" <Simon.Cox@csiro.au> writes:

> Re: Re-using XSD schema-for-schemasIn simpleType derivation-by restriction,
> is it legal to apply both enumeration and pattern constraints in the same
> derivation step?  The first rule in
> http://www.w3.org/TR/xmlschema-2/#defn-rep-constr appears to allow it, and I
> can't find anything that disallows it.
> 
> In other words, is this valid?
> 
> <simpleType name="DrillCodeType">
>     <restriction base="string">
>       <enumeration value="RAB"/>
>       <enumeration value="RC"/>
>       <enumeration value="DD"/>
>       <enumeration value="DD-HQ"/>
>       <enumeration value="DD-NQ"/>
>       <pattern value="other:\w{2,}"/>
>     </restriction>
>   </simpleType>

Sure, that's OK -- facets are facets, you can use as many or as few as
you like, as long as you don't break the obvious rules (e.g. not both
minInclusive and minExclusive, not min > max).

> If yes, is it still OK if the pattern used for a restiction of simpleContent
> in a complexType definition.

Yes -- same rules in both cases.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                      Half-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]

Received on Monday, 30 June 2003 05:15:21 UTC