如何使用JAXB对非基元数据进行序列化?

问题描述 投票:0回答:1

我想使用JAXB对一个对象进行序列化。我的类定义是这样的。

@XmlRootElement
public class MyClass{
     <<How do I annotate this one?>>
     private xyz_type xyz;
     @XmlElement(name = "unique")
     private int unique;
} 
public class xyz_type extends abc_type{
    private qwe_tpe qwe;
    public static final ert_type ARRAY = ert_type.ARRAY; 
} 

先谢谢你的帮助!

java xml-parsing jaxb xml-serialization
1个回答
0
投票

你需要一个客户XML适配器来调集复杂的数据类型。

请参阅本指南。https:/www.baeldung.comjaxb - 6. 复杂数据类型

© www.soinside.com 2019 - 2024. All rights reserved.