我有一个类,我在其中获取对象列表。我正在使用 XmlSeeAlso 注释来包含列表中存在的类。这是我的课:
@XmlRootElement
@XmlSeeAlso({BookStore.class,Book.class,Hello.class})
public class ResponseList {
private List<Object> list;
public List<Object> getList() {
return list;
}
public void setList(List<Object> list) {
this.list = list;
}
}
我收到以下回复:
<responseList>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="book">
<author>Author</author>
<name>The Book</name>
</list>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="bookStore">
<name>The Book Store</name>
<location>US</location>
</list>
</responseList>
我不希望这个 xmls:xsi=... 在响应中。我希望我的输出看起来像这样:
<responseList>
<list>
<author>Author</author>
<name>The Book</name>
</list>
<list>
<name>The Book Store</name>
<location>US</location>
</list>
</responseList>
有没有办法做到这一点?