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

Re: Restricting a union? was RE: Schema for schemas bugs?

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 26 Apr 2002 09:39:04 +0100
Message-ID: <144344908762.20020426093904@jenitennison.com>
To: Simon.Cox@csiro.au
CC: xmlschema-dev@w3.org
Hi Simon,

> Is it possible to derive a simpleType by restriction from a union
> simple type, such that the derived type selects just one of the
> primitivetypes from the union?

There's no way to explicitly say "restrict this union to this
particular type", but in some cases you could achieve the same result
by restricting the union using a pattern.

> For example, starting with a "supertype"
>   <simpleType name="TMDurationType">
>     <union memberTypes="duration positiveInteger double"/>
>   </simpleType>
> can this be restricted to "duration" only?  

So in this case you could use:

<xs:simpleType name="TMPeriodDurationType">
  <xs:restriction base="TMDurationType">
    <xs:pattern value="P.*" />

(You could make the pattern more detailed, but there's no real reason



Jeni Tennison
Received on Friday, 26 April 2002 04:39:10 UTC

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