- From: Michael Shapiro <michael@creativescience.com>
- Date: Thu, 17 May 2001 12:11:20 -0700
- To: <xmlschema-dev@w3.org>
After reading and [(re)*]reading the spec I'm still struggling with
derivation-by-restriction.
Here is the example I'm trying to interpret:
<schema>
<element name="e1"/>
<element name="e2"/>
<element name="e3"/>
<element name="e4"/>
<complexType name="withMandatorySequence">
<annotation>
<documentation>
This complex type defines
the sequence of subsequences.
</documentation>
</annotation>
<restriction base="withOptionalSequence"
<sequence>
<!-- Is it OK to merge the following two subsequences? -->
<!-- And if it's OK, can I get rid of the internal sequence? -->
<sequence>
<element ref="e1" minOccurs="0"/>
<element ref="e2" minOccurs="0"/>
</sequence>
<sequence>
<element ref="e3" minOccurs="0"/>
<element ref="e4" minOccurs="0"/>
</sequence>
</sequence>
</restriction>
</complexType>
<complexType name="withOptionalSequence">
<annotation>
<documentation>
This complex type defines
the sequence of subsequences: the first
subsequence is optional while the
second one is mandatory.
Note that subelements of both subsequences
are optional.
</documentation>
</annotation>
<sequence>
<sequence minOccurs="0">
<element ref="e1" minOccurs="0"/>
<element ref="e2" minOccurs="0"/>
</sequence>
<sequence>
<element ref="e3" minOccurs="0"/>
<element ref="e4" minOccurs="0"/>
</sequence>
</sequence>
</complexType>
<element name="testForRestrictedOptionalSequence">
<complexType>
<restriction base="withOptionalSequence"/>
<sequence>
<element ref="e3"/>
</sequence>
</restriction>
</complexType>
</element>
<element name="testForMandatoryOptionalSequence">
<complexType>
<restriction base="withOptionalSequence">
<sequence>
<sequence>
<!-- Note that there are no elements here -->
<!-- Is it possible to omit this sequence all together? -->
</sequence>
<sequence>
<element ref="e4"/>
</sequence>
</sequence>
</restriction>
</complexType>
</element>
</schema>
Questions:
1. Should I omit the empty sequence in the restricted type?
2. Should I omit the inner sequence?
Thanks for any help,
Michael Shapiro
Received on Thursday, 17 May 2001 15:25:19 UTC