With the default minOccurs and maxOccurs attribute values (both equal to 1), only one of the elements in a set of choices can appear.
If the value of the maxOccurs attribute is greater than 1, that value determines how many of the choices may appear.
A set of choices can also contain nested sequences, additional choice sets, or references to named groups.
A set of choices may be contained in a complex type definition, in sequences, in other sets of choices, or in named group definitions.
File: Schema.xsd
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.java2s.com" xmlns="http://www.java2s.com"
elementFormDefault="qualified">
<xsd:element name="animal" type="animalType" />
<xsd:complexType name="animalType">
<xsd:choice>
<xsd:element name="subspecies" type="xsd:string" />
<xsd:sequence>
<xsd:element name="region" type="xsd:string" />
<xsd:element name="population" type="xsd:integer" />
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
</xsd:schema>
File: Data.xml
<?xml version="1.0"?>
<animal xmlns="http://www.java2s.com">
<subspecies>Russia</subspecies>
</animal>