いくつかの JAXB xjc.exe 生成クラスを単純な XML クラスに変換しようとしています。動的要素に注釈を付ける方法がわかりません。たとえば、スキーマには次のものがあります。
<!-- Message Set Request/Response Pairs and contained requests -->
<xsd:element name="QBXMLMsgsRq">
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="HostQueryRq" type="HostQueryRqType"/>
<xsd:element name="CompanyQueryRq" type="CompanyQueryRqType"/>
<xsd:element name="CompanyActivityQueryRq" type="CompanyActivityQueryRqType"/>
<!-- many more of these choices -->
</xsd:choice>
<xsd:attribute name="oldMessageSetID" type="STRTYPE"/>
<!-- some other attributes -->
</xsd:complexType>
</xsd:element>
これを xjc.exe で実行すると、@XmlElement に対して次の注釈が生成されます
@XmlElements({
@XmlElement(name = "HostQueryRq", type = HostQueryRqType.class),
@XmlElement(name = "CompanyQueryRq", type = CompanyQueryRqType.class),
@XmlElement(name = "CompanyActivityQueryRq", type = CompanyActivityQueryRqType.class),
//+ et al
})
protected List<Object> hostQueryRqOrCompanyQueryRqOrCompanyActivityQueryRq;
では、この JAXB 構造を SimpleXML 注釈付きクラス構造に変換するにはどうすればよいでしょうか?