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

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

<enumeration>
<value>red</value>
<value>white</value>
<value>blue</value>
</enumeration>

> 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
Saxonica

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