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

why is it not possible to define a simple type as an extension in the range of values of another simple type (newbie question)

From: jorma kala <jjkk73@gmail.com>
Date: Sun, 13 Jul 2008 13:19:05 +0200
Message-ID: <bda7ac6d0807130419s68dc7a58gdb9f536890dbbe5@mail.gmail.com>
To: xmlschema-dev@w3.org
I'm quite new to xml schemas.
I do not really understand why if it is possible to define a simple type as
a restriction on the range of values of another simple type, like this for
instance:

  <xsd:simpleType name="type1">
    <xsd:restriction base="xsd:integer">
      <xsd:minInclusive value="0"/>
      <xsd:maxInclusive value="100"/>
    </xsd:restriction>
  </xsd:simpleType>




  <xsd:simpleType name="type2">
    <xsd:restriction base="type1">
      <xsd:minInclusive value="10"/>
      <xsd:maxInclusive value="20"/>
    </xsd:restriction>
  </xsd:simpleType>

the reciprocal operation of defining a simple type as an extension on the
range of values of  another simple type is an error (at least I get an error
with the apache parser):

  <xsd:simpleType name="type1">
    <xsd:restriction base="xsd:integer">
      <xsd:minInclusive value="0"/>
      <xsd:maxInclusive value="100"/>
    </xsd:restriction>
  </xsd:simpleType>




  <xsd:simpleType name="type2">
    <xsd:extension base="type1">
      <xsd:minInclusive value="-100"/>
      <xsd:maxInclusive value="200"/>
    </xsd:extension >
  </xsd:simpleType>

thanks a lot.

jorma k
Received on Monday, 14 July 2008 00:32:35 GMT

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