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

restricting anySimpleType in complexType definition

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


I have a question about restricting anySimpleType.  I wanted to define a
type based on xsd:token that would allow for a few possible values for the
element content and an optional attribute.  After much difficulty, I
finally got the following to validate fine, and it appears to be what I
wanted, but I am not sure if this is legal or just not caught by my
validator (XML Spy 4.4).  The base below is anySimpleType, which I thought
shouldn't work, since it is not a complex type.  Is what I have below
legal, and is there a better way to define a type with an element with
enumerated values and an attribute?

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


Received on Monday, 17 June 2002 15:23:11 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC