[xsd-users] Defaults for minOccurs and maxOccurs
Boris Kolpackov
boris at codesynthesis.com
Fri Mar 13 09:13:15 EDT 2009
Hi Michael,
Forstner Michael <Michael.Forstner at cpg.de> writes:
> IMHO the default for minOccurs and maxOccurs is "1" for both if they
> are not supplied inside a XSD file.
Correct.
> xsd.exe generates an XXX_optional field or every field insiede a XSD
> file which is missing minOccurs and maxOccurs attributes.
I think what happens is you have an outer all or sequence compositor
with minOccurs="0" or a choice compositor, for example:
<sequence minOccurs="0">
<element name="a" type="int"/>
</sequence>
<choice minOccurs="0">
<element name="a" type="int"/>
<element name="b" type="string"/>
</choice>
In the C++/Tree mapping the XSD compiler "flattens" the content
model and computes what we call effective minOccurs and maxOccurs
which are then used to decide which set of accessors/modifiers
to generate.
Boris
More information about the xsd-users
mailing list