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

Enumeration Value Space Difference

From: Swartz, William M <william.m.swartz@lmco.com>
Date: Thu, 15 Jul 2004 13:44:36 -0400
To: xmlschema-dev@w3.org
Message-id: <67A6D6AC2691CF4D937A9A71D5CB5C340C0695@emss09m02.us.lmco.com>


Is there a way to derive from a SimpleType in a way that the derived type allows only a proper subset of the value space of the base type?  This would be analogous to a set difference operation.  I can't use redefine, because I need to continue to use the larger value space of the original (base) type.

For example, if the base type were:

<xs:simpleType name="baseCodeType"> 
  <xs:restriction base="xs:string"> 
    <xs:enumeration value="A"/> 
    <xs:enumeration value="B"/> 

How could I obtain a different type, that derived from "baseCodeType" but only allowed values of "A"?

In Spy, an element of the following derived type accepts values of "A" and "B".  Is this an error in Spy?  I searched the list archives and found that some of the experts believe(d) that the data types standard requires the following derived type to only accept the value "A".

<xs:simpleType name="derivedCodeType"> 
  <xs:restriction base="baseCodeType"> 
    <xs:enumeration value="A"/> 

If the answer is, "No, this can't be done in W3C Schema", then can someone please explain why?   Why has not an xsd:difference element been defined, to go along with xsd:union?

Received on Thursday, 15 July 2004 13:49:43 UTC

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