Page 1 of 1

Require at least one optional unique child?

Posted: Tue Sep 18, 2007 8:14 pm
by steamer25
Is there a way to require the parent element (searchRequest) to have at least one child given the following code? Each child element should occur either once or not at all.

<xs:element name="searchRequest">
<xs:complexType>
<xs:all>
<xs:element name="freeText" type="xs:string" minOccurs="0"/>
<xs:element name="before" type="xs:date" minOccurs="0"/>
<xs:element name="after" type="xs:date" minOccurs="0"/>
<xs:element name="status" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="active"/>
<xs:enumeration value="complete"/>
<xs:enumeration value="onhold"/>
</xs:restriction>
<xs:simpleType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>