RE: Public comment on XML Schemas

Patrick:

If you define a derived datatype 

 

              <xs:simpleType name='yesNoType'>
                                    <xs:restriction base="xs:NMTOKEN">
                                                <xs:enumeration
value="true"/>
                                                <xs:enumeration
value="false"/>
                                                <xs:enumeration
value="yes"/>
                                                <xs:enumeration
value="no"/>
                                                <xs:enumeration
value="ok"/>
                                                <xs:enumeration
value="never"/>
                                                <xs:enumeration
value="1"/>
                                                <xs:enumeration
value="0"/>
                                    </xs:restriction>
                        </xs:simpleType>

 

Then you can define the attributes in the manner you want to.  If you
want to specify 'use' and 'default' properties you can define an
attribute type and then use it by reference.  Am I missing something?

All the best, Ashok 
=========================================================== 
Ashok Malhotra              <mailto: ashokma@microsoft.com
<mailto:%20ashokma@microsoft.com> > 
Microsoft Corporation 
212 Hessian Hills Road 
Croton-On-Hudson, NY 10520 USA 
Redmond: 425-703-9462                New York: 914-271-6477 

 

-----Original Message-----
From: Patrick McCartney [mailto:pat.mccartney@ektron.com] 
Sent: Tuesday, July 30, 2002 4:17 PM
To: W3C XML Schema Comments list
Subject: Public comment on XML Schemas

 


If would be helpful to allow for an attribute type in the same way that
an element type is supported.

 

Currently, if an attribute is defined, as if it were a type, then the
actual attribute element cannot use within the type attribute the
defined attribute type.

 

As an example, suppose I have a type of attribute that supports a
certain set of values that extend the Boolean type to include any
humanly accepted value:

 

            <xs:attribute name="yesnoType" default="true">

                        <xs:simpleType>

                                    <xs:restriction base="xs:NMTOKEN">

                                                <xs:enumeration
value="true"/>

                                                <xs:enumeration
value="false"/>

                                                <xs:enumeration
value="yes"/>

                                                <xs:enumeration
value="no"/>

                                                <xs:enumeration
value="ok"/>

                                                <xs:enumeration
value="never"/>

                                                <xs:enumeration
value="1"/>

                                                <xs:enumeration
value="0"/>

                                    </xs:restriction>

                        </xs:simpleType>

            </xs:attribute>

 

This type of attribute may be used for any number of attributes within
the set of defined elements.  An example, that is not supported, is
this:

 

            <xs:complexType name="statusType">

                        <xs:attribute name="id" type="xs:IDREF"
use="required"/>

                        <xs:attribute name="popup" type="xs:IDREF"/>

                        <xs:attribute name= visible type="b:yesnoType"/>

                        <xs:attribute name= enabled type="b:yesnoType"/>

            </xs:complexType>

 

 

This would greatly reduce the size of a schema that uses these
attributes.

 

 

Received on Wednesday, 31 July 2002 12:24:30 UTC