- From: Avin Patel <vze49rz3@verizon.net>
- Date: Mon, 6 Jan 2003 18:19:46 -0500
- To: "xmlschema" <xmlschema-dev@w3.org>
- Message-ID: <01a801c2b5da$1a596780$643a42d1@Avin>
Hi All, How can I write the XML Schema definition for following data value: value1: <size> <medium/> </size> value2: <size> <value>15</value> </size> One possible way I can think about is: <xsd:element name = "Size" type="SizeType"> <xsd:complexType name ="SizeType"> <xsd:union memberTypes="xsd:integer"> <xsd:simpleType> <xsd:restriction base="xsd:token"> <xsd:enumeration value = "<midium/>"/> <xsd:enumeration value = "<large/>"/> <xsd:enumeration value = "<small/>"/> </xsd:restriction> </xsd:simpleType> </xsd:simpleType> But SAX validators considers value1:<size><medium/></size>, medium as "element" of size "element", not as "value". I can write in another way as: <xsd:element name = "Size" type="SizeType"> <xsd:complexType name ="SizeType"> <xsd:choice> <xsd:element name = "small" type="xsd:integer" default="0" /> <xsd:element name = "large" type="xsd:integer" default="1" /> <xsd:element name = "medium" type="xsd:integer" default="2" /> </xsd:choice> </xsd:complexType> But I am not able mix this definition with integer value definition. complexType mix mode can work for this case, but it is mostly not supported by many XML parser. So I can't use mix mode. Please provide any suggestion. Thank you Avin Patel
Received on Monday, 6 January 2003 18:20:08 UTC