あなたはとしてあなたrequest
要素を定義することができます。
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
FULL例:これは、JAXBは以下のように注釈されているフィールド/プロパティを生成します
<xsd:element name="request">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
any.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="service">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="request"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="request">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
XJCコール
xjc -d out -p forum8776746 any.xsd
サービス
package forum8776746;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"request"
})
@XmlRootElement(name = "service")
public class Service {
@XmlElement(required = true)
protected Request request;
public Request getRequest() {
return request;
}
public void setRequest(Request value) {
this.request = value;
}
}
リクエスト
package forum8776746;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlMixed;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"content"
})
@XmlRootElement(name = "request")
public class Request {
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
}
return this.content;
}
}