W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2002

RE: Public comment on XML Schemas

From: Ashok Malhotra <ashokma@microsoft.com>
Date: Wed, 31 Jul 2002 09:23:44 -0700
Message-ID: <E5B814702B65CB4DA51644580E4853FB03E9FDC9@red-msg-12.redmond.corp.microsoft.com>
To: "Patrick McCartney" <pat.mccartney@ektron.com>, "W3C XML Schema Comments list" <www-xml-schema-comments@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:01 GMT