RE: restricting anySimpleType in complexType definition

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 UTC