background image

Customization results

<< Bind Choice Example | Java-toSchema Examples >>
<< Bind Choice Example | Java-toSchema Examples >>
B
IND
C
HOICE
E
XAMPLE
65
model groups in
example.xsd
by means of a
<jxb:globalBindings>
declara-
tion:
<jxb:bindings schemaLocation="example.xsd" node="/xs:schema">
<jxb:globalBindings bindingStyle="modelGroupBinding"/>
<jxb:schemaBindings/>
<jxb:package name="example"/>
</jxb:schemaBindings>
</jxb:bindings
</jxb:bindings>
This customization results in the
choice
model group being bound to its own
content interface. For example, given the following
choice
model group:
<xs:group name="ModelGroupChoice">
<xs:choice>
<xs:element name="bool" type="xs:boolean"/>
<xs:element name="comment" type="xs:string"/>
<xs:element name="value" type="xs:int"/>
</xs:choice>
</xs:group>
the
globalBindings
customization shown above causes JAXB to generate the
following Java class:
/**
* Java content class for model group.
*/
public interface ModelGroupChoice {
int getValue();
void setValue(int value);
boolean isSetValue();
java.lang.String getComment();
void setComment(java.lang.String value);
boolean isSetComment();
boolean isBool();
void setBool(boolean value);
boolean isSetBool();
Object getContent();
boolean isSetContent();
void unSetContent();
}