2013-07-12 23 views
2

我有一個類,在其中獲取對象列表。我使用XmlSeeAlso註釋來包含列表中存在的類。這裏是我的課:從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> 

有沒有什麼辦法可以實現這個目標?

回答