W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

Re: Derivation of facet values

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 31 Jul 2002 11:02:35 +0100
Message-ID: <43-2141098267.20020731110235@jenitennison.com>
To: Rainer Becker <r.becker@Nitro-Software.com>
CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

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" />

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}" />

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



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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:04 UTC