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

RE: restricting anySimpleType in complexType definition

From: Calvin Smith <calvins@SIMS.Berkeley.EDU>
Date: Mon, 17 Jun 2002 14:34:17 -0700 (PDT)
To: xmlschema-dev@w3.org
Message-ID: <Pine.GSO.4.44.0206171422520.1743-100000@info.sims.berkeley.edu>

Thanks for the helpful comments. Since I couldn't do the following:

<xsd:complexType name="ExampleType">
  <xsd:simpleContent>
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="a possible value"/>
      <xsd:enumeration value="another possible value"/>
      <xsd:attribute name="anAttribute" type="xsd:string"/>
    </xsd:restriction>
  </xsd:simpleContent>
</xsd:complexType>


because the restriction has to be of a complex type, I ended up rewriting
it as follows:

<xsd:complexType name="ExampleType">
  <xsd:simpleContent>
    <xsd:extension base="ExampleEnumerationType">
      <xsd:attribute name="anAttribute type="xsd:string"/>
    </xsd:extension>
  </xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="ExampleEnumerationType">
  <xsd:restriction base="xsd:string">
    <xsd:enumeration value="a possible value"/>
    <xsd:enumeration value="another possible value"/>
  </xsd:restriction>
</xsd:simpleType>

Does anybody know of a simpler way of expressing this, without defining a
simpleType and extending it with the attribute?

Thanks,

calvin
Received on Monday, 17 June 2002 17:34:18 GMT

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