XML: How to require either or both of two child elements, but prevent both missing?

Nozomi Ytow nozomi at BIOL.TSUKUBA.AC.JP
Sun Feb 23 07:58:45 CET 2003

jrc> How about changing the model to 'choice' and requiring one but allowing two
jrc> (or multiple) occurrences of optional elements?
jrc> something like this maybe?

jrc> <xs:choice minOccurs="1" maxOccurs="2">
jrc>  <xs:element name="A" minOccurs="0" maxOccurs="1"/>
jrc>  <xs:element name="B" minOccurs="0" maxOccurs="1"/>
jrc> </xs:choice>

Dosn't it alllow the choice whithout A nor B for their minOccurs=0?

Substition group would do.


More information about the tdwg-content mailing list