Re: Derivation of facet values

Hi Rainer,

> Could it be that, the fixed-Attribute on facets must be regarded as
> a means to protect your code against any kind of derivation?
> Especially when your schema is being included or imported?
 
Yes, I think that's what it's meant to be used for, it's just that I
can't particularly think of a reason why you'd want to prevent
derivations that change *particular facets* of a type. Why, for
example, would you want to state that the length of a UKPostcodeType
must be between 6 and 8 characters but not allow others to derive a
NottinghamPostcodeType that is between 7 and 8 characters long? These
derivations are always restrictions, so it's not as if your code will
break if a more specific type is used. I can kinda see why you might
want to prevent *any* derivation from a specific simple type, just
can't come up with a good example where you'd want to prevent
derivations that involve restricting a particular facet.

It's particularly weird on the minLength/maxLength front since people
can always use the pattern facet to get around any restrictions that
you place on the string. Take the UKPostcodeType example. If I did:

<xs:simpleType name="UKPostcodeType">
  <xs:restriction base="xs:token">
    <xs:minLength value="6" fixed="true" />
    <xs:maxLength value="8" fixed="true" />
  </xs:restriction>
</xs:simpleType>

you could always create a restricted type that, in effect, allowed a
minimum of 7 characters using:

<xs:simpleType name="NottinghamPostcodeType">
  <xs:restriction base="UKPostcodeType">
    <xs:pattern value=".{7,8}" />
  </xs:restriction>
</xs:simpleType>

And it's funny, because I can see reasons for having "fixed"
enumerated values (i.e. specifying that certain enumerated values must
always be allowed in derived types) but of course that isn't something
that you can express in XML Schema.

I'm sure that the WG had a use case in mind, I just wonder what it
was.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Wednesday, 31 July 2002 06:02:37 UTC