See my reply below.

/Andrew Paterson/:

If I use:

<element name="test">
  ...
  <group ref="test_group" minOccurs="0"/>
  ...
</element>

<group name="test_group">
  <sequence>
    <element name="field1" type="string" minOccurs="1"/>
    <element name="field2" type="string" minOccurs="1"/>
  </sequence>
</group>

The schema allows me to leave out <field1> and <field2> elements from the
<test> element even though they are mandatory in the group - i.e. it takes
notice of the minOccurs="0" attribute on the group reference. However, if the
situation is reversed (as in my original e-mail):

<element name="test">
  ...
  <group ref="test_group" minOccurs="1"/>
  ...
</element>

<group name="test_group">
  <sequence>
    <element name="field1" type="string" minOccurs="0"/>
    <element name="field2" type="string" minOccurs="0"/>
  </sequence>
</group>

it ignores the minOccurs="1" attribute on the group reference and allows the
elements to be omitted.

Nothing is ignored but both definitions are effectively the same - see "Schema Component Constraint: Effective Total Range (all and sequence)" <http://www.w3.org/TR/xmlschema-1/#cos-seq-range>. In the first case you get:

  test_group->minOccurs * (field1->minOccurs + field2->minOccurs)

  0 * (1 + 1) = 0

and in the second:

  1 * (0 + 0) = 0

--
Stanimir

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to