W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2004

RE: Multiple Types for an element

From: Xan Gregg <Xan.Gregg@jmp.com>
Date: Fri, 2 Apr 2004 17:56:36 -0500
Message-ID: <939FBCFFFF9B0C40BF8B53294E2296DB4AF7C2@merc20.na.sas.com>
To: "Shashikala Shamarao" <shashikala_shamarao@yahoo.com>, <xmlschema-dev@w3.org>
Your message came through a bit garbled, but I think what you are trying to do might be best done with either substitution groups or xsi:type.  With xsi:type, you would define:
type anyHotel
type hotel1 derived from anyHotel
type hotel2 derived from anyHotel
element property1 of type anyHotel
then the instance would contain something like
<property1 xsi:type="hotel1" name="H1" address="A1"/>


From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On Behalf Of Shashikala Shamarao
Sent: Monday, March 29, 2004 8:19 PM
To: xmlschema-dev@w3.org
Subject: Multiple Types for an element

	Is there a way to define multiple types for an element?

	For example


	but if I want an XML like below:



	     <property1 name="H1" address1="A1"/>

	     <property1 name="H2" address1="A2"/>



	How can I define XML Schema? Basically I want one property element to have hotel1 as type and other one as hotel2. Is there a way to do such things? If so could somebody please mail me a Schema which does that.

Received on Friday, 2 April 2004 17:56:48 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:04 UTC