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

I'm not sure if this is that much better, it does save a line or two. 


<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" use="required"> 
   <xs:simpleType>
    <xs:restriction base="xs:string">
     <xs:enumeration value="YES"/>
     <xs:enumeration value="NO"/>
    </xs:restriction>
   </xs:simpleType>
  </xs:attribute>
 </xs:complexType>

</xs:schema>

Actually I'm wrong. Although it has fewer constructs it is longer. Go
figure. 

-- 
PITHY WORDS OF WISDOM 
Computers are not intelligent. They only think they are.
 
This posting is provided "AS IS" with no warranties, and confers no
rights. 
You assume all risk for your use. (c) 2002 Microsoft Corporation. All
rights reserved.



> -----Original Message-----
> From: Randy Eastwood [mailto:sunmesa@cox.net] 
> Sent: Monday, April 15, 2002 1:03 AM
> To: W3C XSchema List
> Subject: is the best/only way to restrict the values of an attribute
> 
> 
> 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:11:18 UTC