Click to See Complete Forum and Search --> : xsd type definition question...


jdoy
December 1st, 2003, 05:42 AM
Hi all,

Well i have a question about defining types in xsd... I like to know if it's possible to define an element which is either of one type or another. I explain.

Imagine <xs:element name="result" type "data">

....

and i like to define this type data either as int or as boolean.=> How to define then my type data???? I suppose i have to do something like

<xs:complexType name="data">, but then...... How to do the "either...or" ??

Thanx in advance for helping, it would be very nice of you....

erwin_78
December 1st, 2003, 08:04 AM
with this sample you can define in your xml that the data maybe:"boolean" or "int".
You can add more if you want

<xsd:simpleType name="SupportedDataType">
&nbsp;&nbsp;<xsd:restriction base="xsd:string">
&nbsp;&nbsp;&nbsp;&nbsp;<xsd:enumeration value="boolean"/>
&nbsp;&nbsp;&nbsp;&nbsp;<xsd:enumeration value="int"/>
&nbsp;&nbsp;</xsd:restriction>
</xsd:simpleType>