Why would this Schema:
<xsd:complexType name="ErrType">
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:element name="errorCode" type="xsd:string"/>
<xsd:element name="errorDescription" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
Generate to this Java code:
class ErrType {
@XmlElementRefs({
@XmlElementRef(name = "errorCode", namespace = "http://somewhere/blah.xsd", type = JAXBElement.class),
@XmlElementRef(name = "errorDescription", namespace = "http://somewhere/blah.xsd", type = JAXBElement.class)
})
protected List<JAXBElement<String>> errorCodeAndErrorDescription;
// ...
}
I would have expected something more like:
class ErrType extends ArrayList<ErrTypeEntry> {}
class ErrTypeEntry {
protected String errorCode
protected String errorDescription;
}
Okay, so I guess the answer is: because it does. Combining two fields into a single one seems very undesirable. It removed important structure unnecessarily.