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

complexTypes, attributes, and enumerations

From: MALIK, NAUMAN <NAUMAN.MALIK@DFAS.MIL>
Date: Thu, 15 Aug 2002 19:20:31 -0600
Message-Id: <5.1.0.14.1.20020815192024.02513cf0@localhost>
To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>




Hi,

It seems that currently there is no way to inline a list of enumerated 
types inside a complexType (which is needed in the first place to house 
required attributes).  I want to have this named complexType have simple 
content which is limited to a series of values.

This currently seems to be the proper way to do it:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:complexType name="BureauCodeType">
		<xs:simpleContent>
			<xs:extension base="abc">
				<xs:attribute name="uid" type="xs:string" use="required"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:simpleType name="abc">
		<xs:restriction base="xs:string">
			<xs:enumeration value="a"/>
			<xs:enumeration value="b"/>
			<xs:enumeration value="c"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>

But I contend that the named simpleType is superfluous and there should be 
a better way to do this, such as follows:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:complexType name="BureauCodeType">
		<xs:simpleContent>
			<xs:extension base="abc">
				<xs:enumeration value="a"/>
				<xs:enumeration value="b"/>
				<xs:enumeration value="c"/>
				<xs:attribute name="uid" type="xs:string" use="required"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
</xs:schema>

Or some other way.

It is ridiculous to have to create a separate named simpleType (and the 
configuration management that goes along with it) JUST to be able to 
"extend" it in my named complexType.  There should be a way to "inline" the 
enumerations inside the named complexType itself.

Thanks.

--Nauman Malik
XMLCG, Inc. 
Received on Thursday, 15 August 2002 21:21:45 GMT

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