なぜこのスキーマなのか:
<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>
このJavaコードを生成します。
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;
// ...
}
私はもっと次のようなものを期待していたでしょう:
class ErrType extends ArrayList<ErrTypeEntry> {}
class ErrTypeEntry {
protected String errorCode
protected String errorDescription;
}
さて、答えはそうだと思います。2つのフィールドを1つのフィールドに結合することは非常に望ましくないようです。重要な構造を不必要に削除しました。