W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2011

Re: I recommend the following changes to XML Schema simpleType facets

From: Michael Kay <mike@saxonica.com>
Date: Fri, 22 Apr 2011 18:09:03 +0100
Message-ID: <4DB1B62F.30409@saxonica.com>
To: xmlschema-dev@w3.org
On 22/04/2011 17:51, Costello, Roger L. wrote:
> Hi Folks,
> I recommend the following changes to XML Schema simpleTypes.

We can all think of many ways of improving the XSD language if backwards 
compatibility were not a constraint. Sadly, we don't have that luxury - 
we're stuck with the mistakes of the past.

(And quite apart from backwards compatibility, I've been surprised how 
even the most obviously "wrong" design decisions in XSD 1.0 will be 
adamantly defended by someone, often with a plausible rationale: people 
come to this thing from many different directions and with different 
perspectives on what is obviously right.)

> 1. Each simpleType may have only one enumeration facet. The value of its "value" attribute can be a list of pipe-separated values. E.g., do not do this:
> <simpleType name="Colors">
>      <restriction base="string">
>          <enumeration value="red" />
>          <enumeration value="white" />
>          <enumeration value="blue" />
>      </restriction>
> </simpleType>
> Instead, do this:
> <simpleType name="Colors">
>      <restriction base="string">
>          <enumeration value="red|white|blue" />
>      </restriction>
> </simpleType>

So what if there's a vertical bar one of the values? A more logical 
syntax here would be


> 2. If a simpleType contains multiple pattern facets, they should be AND-ed together (instead of OR-ed together).
I agree that would have been a much more sensible choice. Just as 
multiple attribute wildcards should be OR-ed together rather than 
AND-ed. But in both cases, it's too late to change it now.

Michael Kay
Received on Friday, 22 April 2011 17:09:24 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:19 UTC