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

is the best/only way to restrict the values of an attribute

From: Randy Eastwood <sunmesa@cox.net>
Date: Mon, 15 Apr 2002 04:02:50 -0400
Message-ID: <000701c1e453$f022b730$0100007f@Localhost>
To: "W3C XSchema List" <xmlschema-dev@w3.org>
Can someone tell me if this is the best/only way to restrict the values of an attribute?
I only have one attribute named "allow" and I want it to be either YES or NO.

Am I taking a bad approach here? It seems I have one layer to many. How/Can I reduce?

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="TEIMSettings">
 <xs:complexType>
  <xs:sequence>
    <xs:element name="LACAllowTIRUpload" type="allowAttribute"/>
    <xs:element name="LACAllowTIRDelete" type="allowAttribute"/>
  </xs:sequence>
 </xs:complexType>
</xs:element>

<xs:complexType name="allowAttribute" >
 <xs:attribute name="allow" type="allowValues" use="required"/>
</xs:complexType>

<xs:simpleType name="allowValues">
 <xs:restriction base="xs:string">
  <xs:enumeration value="YES"/>
  <xs:enumeration value="NO"/>
 </xs:restriction>
</xs:simpleType>

</xs:schema>
Received on Monday, 15 April 2002 04:03:14 GMT

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