You can specify how many times a specific element in a complex type appears using the element
element's minOccurs
attribute and maxOccurs
attribute. The default value for both attributes is 1
.
When you set one of the complex type's member element's minOccurs
attribute to 0
, the @XmlElement
annotation decorating the corresponding Java member variable is changed. Instead of having its required property set to true
, the @XmlElement
annotation's required property is set to false
.
In XML Schema you can specify that an element must occur more than once in an instance of the type by setting the
element
element's minOccurs
attribute to a value greater than one.
However, the generated Java class will not support the XML Schema constraint. FUSE Services Framework generates the supporting Java member
variable as if the minOccurs
attribute were not set.
When you want a member element to appear multiple times in an instance of a complex type, you set the element's
maxOccurs
attribute to a value greater than 1. You can set the
maxOccurs
attribute's value to unbounded
to specify that the member
element can appear an unlimited number of times.
The code generators map a member element with the maxOccurs
attribute set to a value
greater than 1 to a Java member variable that is a List<T>
object. The base class of the list is
determined by mapping the element's type to Java. For XML Schema primitive types, the wrapper classes are used as described in
Wrapper classes. For example, if the member element is of type xsd:int
the generated member variable is a List<Integer>
object.