Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
@围绕多个元素的XmlElementWrapper_Xml_Jaxb - Fatal编程技术网

@围绕多个元素的XmlElementWrapper

@围绕多个元素的XmlElementWrapper,xml,jaxb,Xml,Jaxb,我正在尝试将以下xml映射到jaxb <SingleRef type="ref" refid="aaa"> <keySet> <bvId>xxxx</bvId> <bvGuId>xxxx</bvGuId> <bvSourceGuId>xxxx</bvSourceGuId> </kpp:keySet> <Sin

我正在尝试将以下xml映射到jaxb

<SingleRef type="ref" refid="aaa">      
   <keySet> 
       <bvId>xxxx</bvId>
       <bvGuId>xxxx</bvGuId>
       <bvSourceGuId>xxxx</bvSourceGuId>
   </kpp:keySet>    
<SingleRef>
但它会显示一条错误消息,显示仅允许在集合属性上使用@XmlElementWrapper。有没有其他办法

package com.rahal;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;

public class SingleRef {

private String type;
private String refId;
private String bvId;
private String bvGuId;
private String bvSourceGuId;

public String getType() {
    return type;
}
@XmlAttribute
public void setType(String type) {
    this.type = type;
}
public String getRefId() {
    return refId;
}
@XmlAttribute
public void setRefId(String refId) {
    this.refId = refId;
}
public String getBvId() {
    return bvId;
}
@XmlElementWrapper(name = "keySet")
@XmlElement(name = "bvId")
public void setBvId(String bvId) {
    this.bvId = bvId;
}
public String getBvGuId() {
    return bvGuId;
}
@XmlElementWrapper(name = "keySet")
@XmlElement(name = "bvGuId")
public void setBvGuId(String bvGuId) {
    this.bvGuId = bvGuId;
}
public String getBvSourceGuId() {
    return bvSourceGuId;
}
@XmlElementWrapper(name = "keySet")
@XmlElement(name = "bvSourceGuId")
public void setBvSourceGuId(String bvSourceGuId) {
    this.bvSourceGuId = bvSourceGuId;
}

}