- From: Seema <2kseema@sun20.datamatics.com>
- Date: Tue, 8 Jan 2002 18:22:38 +0530
- To: <xmlschema-dev@w3.org>
- Message-ID: <001201c19843$5a4337f0$524111cf@datamatics.com>
Hi all, I have a schema written for XML's that would represent a Form in html. The elements of the Form like textbox, textarea, etc would appear any no. of times in any order, however, there is a pair of tags, namely <Optional> and <Mandatory> Out of these only one of them may appear, at a time in the form and only a single instance might appear. How do I tackle this. My present schema handles it in the following way : <xsd:complexType name="FormType" > <xsd:choice minOccurs="0" maxOccurs="1" > <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element name="TextBox" type="TextBoxType" /> <xsd:element name="TextArea" type="TextAreaType" /> <xsd:element name="Header" type="HeaderType"/> <xsd:element name="RadioButton" type="RadioButtonType" /> <xsd:element name="SelectList" type="SelectListType" /> <xsd:element name="Mandatory" type="EmptyType" maxOccurs="1"/> </xsd:choice> <xsd:choice minOccurs="0" maxOccurs="unbounded"> <xsd:element name="TextBox" type="TextBoxType" /> <xsd:element name="TextArea" type="TextAreaType" /> <xsd:element name="Header" type="HeaderType"/> <xsd:element name="RadioButton" type="RadioButtonType" /> <xsd:element name="SelectList" type="SelectListType" /> <xsd:element name="Optional" type="EmptyType" maxOccurs="1"/> </xsd:choice> </xsd:choice> </xsd:complexType> However, the condition that only one occurence of the tag (Optional or Mandatory) should appear is not satisfied while validating the XML with the schema. Please suggest a suitable solution. Thanks in advance Seema
Received on Tuesday, 8 January 2002 07:55:01 UTC