XMLスキーマを開発しようとしています。これは調査用であり、XMLの例は次のようになります。
<survey>
<instructions>Please complete the survey.</instructions>
<section>
<sectionHeader>Multiple Choice: Select the most appropriate answer.</sectionHeader>
<item>
<question>What is your favorite color?</question>
<answer>
<option>red</option>
<option>yellow</option>
<option>blue</option>
</answer>
</item>
<item>
<question>What is your favorite shape?</question>
<answer>
<option>circle</option>
<option>square</option>
<option>triangle</option>
</answer>
</item>
</section>
<section>
<sectionHeader>Free Response: Type a Response</sectionHeader>
<item>
<question>Who is your idol and why?</question>
<answer>
<textbox>Type your answer here.</textbox>
</answer>
</item>
<section>
</survey>
基本的に、回答には1つ以上のオプション、または1つのテキストボックスを含めることができます。また、調査には1つ以上のセクションが含まれている必要があり、各セクションには1つ以上の項目を含めることができます。私は現在、次のxmlスキーマを持っています。
<xs:element name="survey">
<xs:complexType>
<xs:element name="instructions" type="xs:string"/>
<xs:element name="section">
<xs:complexType>
<xs:element name="sectionHeader" type="xs:string"/>
<xs:element name="item"/>
<xs:complexType>
<xs:element name="question" type="xs:string"/>
<xs:element name="answer">
?? Choice between multiple options or one text box ??
</xs:element>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
ただし、これでは1つのセクションと1つのアイテムしか使用できません。これらのタグの1つ以上を順番に許可するようにしたい。また、回答タグに1つ以上のオプションまたは1つのテキストボックスを含める必要があります。これどうやってするの?