- From: Jeremy Vander Kam (ARC) <Jeremy.C.VanderKam@nasa.gov>
- Date: Mon, 01 Dec 2003 13:27:18 -0500
- To: xmlschema-dev@w3.org
Hi all,
I would like to do something like this:
<xsd:complexType name="MyType">
<xsd:choice>
<xsd:element name="Distribution" type="DistType"/>
<xsd:simpleContent>
<xsd:extension base="xsd:double">
<xsd:attribute name="type" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="double"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:choice>
</xsd:complexType>
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:
<Variable>42.1</Variable>
or
<Variable>
<Distribution/>
</Variable>
But NOT mixed content such as:
<Variable>
42.1<Distribution/>
</Variable>
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.
Thanks!
----------
Jeremy Vander Kam
Aerospace Engineer
Systems Analysis Branch
NASA Ames Research Center
Jeremy.C.VanderKam@nasa.gov
513 871 7425
Received on Monday, 1 December 2003 13:32:02 UTC