Re: restrictions with nested simpleTypes.

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 UTC