W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2000

Re: restrictions with nested simpleTypes.

From: Martin Gudgin <marting@develop.com>
Date: Sun, 10 Dec 2000 19:40:57 -0800
Message-ID: <003c01c06324$2cde42f0$d839f940@greyarea>
To: "Jason Diamond" <jason@injektilo.org>, <xmlschema-dev@w3.org>
Hi Jason,

Because maybe you don't want to expose the inner type to the outside
world... If it only gets used in one context then it makes sense to 'hide'
it like this.

FWIW the Schema-for-schemas uses this technique for the type of maxOccurs;

<simpleType name="allNNI">
  <annotation><documentation xml:lang="en">
   for maxOccurs</documentation></annotation>
  <union memberTypes="nonNegativeInteger">
   <simpleType>
    <restriction base="NMTOKEN">
     <enumeration value="unbounded"/>
    </restriction>
   </simpleType>
  </union>
 </simpleType>

Or is your question about having a restriction within a restriction? If so
then I can't of the top of my head think of a situation where you would
*need* to do it that way. The syntax allows it but

<xsd:simpleType name='fooType'>
  <xsd:restriction>
    <xsd:simpleType>
      <xsd:restriction base='xsd:string'>
        <xsd:minLength value='6' />
      </xsd:restriction>
    </xsd:simpleType>
  </xsd:restriction>
</xsd:simpleType>

would have the same value space and lexical space as;

<xsd:simpleType name='fooType'>
  <xsd:restriction base='xsd:string'>
    <xsd:minLength value='6' />
  </xsd:restriction>
</xsd:simpleType>

although at the component level they would look slightly different.

Gudge

----- Original Message -----
From: "Jason Diamond" <jason@injektilo.org>
To: <xmlschema-dev@w3.org>
Sent: Sunday, December 10, 2000 6:58 PM
Subject: restrictions with nested simpleTypes.


> I don't understand why the base attribute isn't good enough. Why would you
> ever do this?
>
> <xsd:simpleType name="fooType">
>   <xsd:restriction>
>     <xsd:simpleType>
>       <xsd:restriction base="xsd:string">
>         <!-- ... -->
>       </xsd:restriction>
>     </xsd:simpleType>
>     <!-- ... -->
>   </xsd:restriction>
> </xsd:simpleType>
>
> Thanks,
> Jason.
Received on Sunday, 10 December 2000 22:42:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:19 GMT