Jaxb 如何从xml中删除元素名?

Jaxb 如何从xml中删除元素名?,jaxb,apache-camel,swagger,Jaxb,Apache Camel,Swagger,我正在尝试创建person rest服务,并尝试使用JAXB创建xml模式,使用Jackson创建JSon模式 这里是我的模型类,用于创建相应的XML和JSon负载 package www.tempuri.person.model; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlRootElem

我正在尝试创建person rest服务,并尝试使用JAXB创建xml模式,使用Jackson创建JSon模式

这里是我的模型类,用于创建相应的XML和JSon负载

package www.tempuri.person.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonRootName;

@ApiModel(value="GetPerson Message",description = "Personal Input Request")
@XmlRootElement(name="getPerson")
@JsonRootName(value = "getPerson")
public class GetPersonWrapper {

    @ApiModelProperty(value = "GetPerson", required = true)
    private GetPerson getPerson;

    public GetPerson getGetPerson() {
        return getPerson;
    }

    public void setGetPerson(GetPerson getPerson) {
        this.getPerson = getPerson;
    }
}

package www.tempuri.person.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(description = "Represents Persons")
public class GetPerson {

    @ApiModelProperty(value = "Application Area of GetPerson", required = true)
    private ApplicationArea applicationArea;

    @ApiModelProperty(value = "Data Area of GetPerson", required = true)
    private DataAreaGet dataArea;

    /**
     * @return the dataArea
     */
    public DataAreaGet getDataArea() {
        return dataArea;
    }

    /**
     * @param dataArea the dataArea to set
     */
    public void setDataArea(DataAreaGet dataArea) {
        this.dataArea = dataArea;
    }

    public ApplicationArea getApplicationArea() {
        return applicationArea;
    }

    public void setApplicationArea(ApplicationArea applicationArea) {
        this.applicationArea = applicationArea;
    }
}
有了上述模型类,json模式就如预期的那样出现了。但对于xml,我无法得到我想要的: 以下是它以xml生成的架构:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<getPerson>
    <getPerson>
        <applicationArea/>
        <dataArea>
            <description>string</description>
            <id>0</id>
            <name>string</name>
        </dataArea>
    </getPerson>
</getPerson>

一串
0
一串
如您所见,我得到了两个getPerson节点。如何仅使用jaxb注释删除其中一个getPerson节点。

我正在使用apachecamel-swagger组件创建rest服务


期待您的解决方案。提前感谢。

我会使用XSLT,简单明了,工作起来很神奇