I have such xsd. These all fields can exist or not and in unpredictable order.
You need to put the minOccurs
on the individual elements, not the <xs:all>
, i.e.
<xs:all>
<xs:element ref="field1" minOccurs="0"/>
<xs:element ref="field2" minOccurs="0"/>
<xs:element ref="field3" minOccurs="0"/>
<xs:element ref="field4" minOccurs="0"/>
<xs:element ref="field5" minOccurs="0"/>
</xs:all>
Putting minOccurs="0"
on the <xs:all>
is saying that entire group may be omitted, not individual elements.
See XML Schema docs.
try like this in all
<xs:element ref="field4" minOccurs="0" >