Zoo tutorials: [ SQL | Java | Linux | XML ]

A Gentle Introduction to xml

maxOccurs on choice and sequence

The expression <xsd:choice maxOccurs="unbounded"> allows the contents to be repeated one or more times.

The expression <xs:element name="X" maxOccurs="unbounded"> allows the single element to be repeated one or more times.

Rule to be enforced:

The schema given is not correct. It is too generous.

min and max

Schema


XML input

ValidInvalid
<country>
  <!-- United kingdom -->
  <county>Kent</county>
  <county>Essex</county>
  <borough>Coventry</borough>
</country>
<country>
  <state>Airstrip 1</state>
  <county>Borsetshire</county>
  <!-- May not mix state and county -->
</country>
<country>
  <!-- USA -->
  <state>Ohio</state>
  <state>Oklahoma</state>
</country>
<country>
  <state>England</state>
  <borough>Coventry</borough>
  <!-- May not mix state and borough-->
</country>
<country>
  <!-- United kingdom -->
  <county>Kent</county>
  <county>Essex</county>
</country>
<country>
  <!-- Must have something -->
</country>