3
私は人restサービスを作成しようとしています。また、JAXBとJSon Schemaを使用してJacksonを使用してxmlスキーマを作成しようとしています。xmlから要素名を削除するには?
私のModelクラスは、それぞれの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の場合、私は私がしたいものを取得することはできないです:あなたは、私が2 getPersonノードを取得しています見ることができるように
<?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>
:以下 それはXMLで生成されたスキーマです。 jaxbアノテーションのみを使用してgetPersonノードの1つを削除するにはどうすればよいですか。
私はapache camel swaggerコンポーネントを使用して休憩サービスを作成しています。
あなたのソリューションを楽しみにしています。前もって感謝します。