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

Multiple Types for an element

From: Shashikala Shamarao <shashikala_shamarao@yahoo.com>
Date: Mon, 29 Mar 2004 17:18:38 -0800 (PST)
Message-ID: <20040330011839.30033.qmail@web40204.mail.yahoo.com>
To: xmlschema-dev@w3.org

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

For example


I have a schema like below:


     <element name="Feature1" type="x1:Feature1"/>


     <complexType name="Feature1">


               <element name="property1" type="x1:hotel1" />




     <complexType name="hotel1">

          <attribute name="name" type="string" fixed="H1"/>

          <attribute name="address1" type="string" fixed="A1"/>



     <complexType name="hotel2">

          <attribute name="name" type="string" fixed="H2"/>

          <attribute name="address1" type="string" fixed="A2"/>



which would give me an XML like below



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



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.


Thanks in advance.
Shashikala Shamarao

Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
Received on Tuesday, 30 March 2004 13:08:54 UTC

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