您可以使用以下
更改Jackson(XML)<?xml version='1.0' encoding='UTF-8'?>
<status id="1" count="5471">
<status>Finished</status>
</status>
改为:
<?xml version='1.0' encoding='UTF-8'?>
<status id="1" count="5471">Finished</status>
我的代码如下所示:
@JsonRootName("status")
public class StatusDto {
@JacksonXmlProperty(isAttribute = true)
private Long id;
private String status;
@JacksonXmlProperty(isAttribute = true)
private Integer count;
...
}
答案 0 :(得分:3)
您可以使用@JacksonXmlText
。
@JsonRootName("status")
class StatusDto {
@JacksonXmlProperty(isAttribute = true)
private Long id;
@JacksonXmlText
private String status;
@JacksonXmlProperty(isAttribute = true)
private Integer count;
}