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

Multiple Type definition

From: Jingkun Hu <hujingkun@yahoo.com>
Date: Mon, 20 May 2002 13:46:50 -0400 (EDT)
Message-ID: <20020520174634.78814.qmail@web14603.mail.yahoo.com>
To: xmlschema-dev@w3c.org
Your quick reply will be greatly appreciated.

My question is if I can assign multiple types to a
sequence of elements with same element name. The
following is a block of an example:

           <xsd:complexType name="procedure_report">
		<xsd:sequence>
			<xsd:element name="item" type="item_1"
minOccurs="0"/>
			<xsd:element name="item" type="item_2"/>
			<xsd:element name="item" type="item_3"
maxOccurs="unbounded"/>
			<xsd:element name="item" type="item_4"
minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType> 

here, item_1, .., item_4 can be simpleType or
complexType.

The trick here is that not all the elements - 'item'
are mandatory, e.g., if the first item is missing, the
validation engine doesn't know which type to use for
validating the present item. 

Anyway, my observation is that XMLSpy and XSV don't
complain this Schema definition. But it validates the
second item (here, the first item is not provided)
against the item_1's definition. When I use Microsoft
parser, it complains the Schema definition by saying
"mutiple definition for a single element".

I'm wondering if multiple type definition for a single
element is allowed in the current XML Schema
specification. If yes, which tools support it?

Jingkun

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
Received on Tuesday, 21 May 2002 05:29:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:02 UTC