您好,我正在尝试将一些 xml 编组到其中包含内部类的 java 类中,但是遇到了一个问题:内部类不会填充外部类——它们是空值。
<forms>
<form mkgu-id="0" foreign-id="ticket-department-252-2017-12-12--0">
<data>
//some data
</data>
<rates>
<rate indicator-id="2" value-id="45">45</rate>
<rate indicator-id="13" value-id="49">49</rate>
<rate indicator-id="221" value-id="55">55</rate>
<rate indicator-id="42" value-id="60">60</rate>
<rate indicator-id="53" value-id="65">65</rate>
</rates>
</form>
</forms>
这是费率和费率类:
@XmlRootElement(name = "rate")
public class Rate {
@XmlAttribute(name = "indicator-id")
private int indicatorId;
@XmlAttribute(name = "value")
private int value;
@XmlElement(name = "rate")
private int rate;
费率
@XmlRootElement(name = "rates")
public class Rates {
@XmlElement
private ArrayList<Rate> rates;
当我解析时,我将类实现作为字符串,如下所示:
Forms{forms=[Form{mkguId=0, foreignId=ticket-department-252-2017-12-12--0, data=//一些数据, service=Service{id=1410073997, service='null'},程序=0,权限=权限{id=1411364330,权限='null'},日期='2017-12-11 18:00:00',receivedDate='2017-12-12 07:42:31',okato ='53401373000'}, rates=Rates{rates=null}}]}
有些字段没有填写正确。我缺少什么以及如何解决它?
慕运维8079593
相关分类