W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2003

xsd:choice between simpleContent and an element

From: Jeremy Vander Kam (ARC) <Jeremy.C.VanderKam@nasa.gov>
Date: Mon, 01 Dec 2003 13:27:18 -0500
Message-Id: <>
To: xmlschema-dev@w3.org

Hi all,

I would like to do something like this:

<xsd:complexType name="MyType">
   <xsd:element name="Distribution" type="DistType"/>
     <xsd:extension base="xsd:double">
       <xsd:attribute name="type" use="required">
             <xsd:restriction base="xsd:string">
               <xsd:enumeration value="double"/>

So I have the option of defining an element by either a set of attributes 
and simple content OR by a child element.... Is this possible? If so, how? 
I would like to be able to specify something like:

<xsd:element name="Variable" type="MyType/>

  such that the resulting XML could be either:




But NOT mixed content such as:


So I guess the "gotcha" is that I want to control the type of the content 
when it is simpleContent - making it xsd:double in this example.


Jeremy Vander Kam
Aerospace Engineer
Systems Analysis Branch
NASA Ames Research Center
513 871 7425
Received on Monday, 1 December 2003 13:32:02 UTC

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