xjc を使用して、XSD から Java オブジェクトを作成しました。
そして今、xmlドキュメントをJavaオブジェクトに非整列化しようとしていますが、次のようになります:
javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"GlobalComponentInformation
ここにいる?
編集:
org.w3c.dom.Document オブジェクトを渡しています。これは Web サービス呼び出し (軸 Web サービス) から返されました...
ここで解析される ws から返された Document オブジェクトには、次のルート要素が含まれていることに注意してください。
<GlobalInformationResponseDocument xmlns="" />
@XmlRootElement クラスは次のようになります。
XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"wsExternalResponse"
})
@XmlRootElement(name = "GlobalInformationResponseDocument")
public class GlobalInformationResponseDocument {
@XmlElement(name = "WS_ExternalResponse", required = true)
protected WSExternalResponseType wsExternalResponse;
/**
* Gets the value of the wsExternalResponse property.
*
* @return
* possible object is
* {@link WSExternalResponseType }
*
*/
public WSExternalResponseType getWSExternalResponse() {
return wsExternalResponse;
}
/**
* Sets the value of the wsExternalResponse property.
*
* @param value
* allowed object is
* {@link WSExternalResponseType }
*
*/
public void setWSExternalResponse(WSExternalResponseType value) {
this.wsExternalResponse = value;
}
}
パッケージ情報:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.mycompany.com/GlobalInformationResponseExt",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package com.company.jaxb.client;