使用改造2进行XML解析

时间:2017-11-10 10:59:07

标签: android xml retrofit2

我在使用改装转换器解析http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml此xml文档时遇到问题 如何为这种类型的xml文档创建Pojo类以进行改造xml转换器?

1 个答案:

答案 0 :(得分:0)

像这样为创建一个pojo类

<强> GESMES:信封

public class Gesmes:Envelope
{
private Cube Cube;

public Cube getCube ()
{
    return Cube;
}

public void setCube (Cube Cube)
{
    this.Cube = Cube;
}

@Override
public String toString()
{
    return "ClassPojo [Cube = "+Cube+"]";
}
}

多维数据集类

public class Cube
{
private String rate;

private String currency;

public String getRate ()
{
    return rate;
}

public void setRate (String rate)
{
    this.rate = rate;
}

public String getCurrency ()
{
    return currency;
}

public void setCurrency (String currency)
{
    this.currency = currency;
}

@Override
public String toString()
{
    return "ClassPojo [rate = "+rate+", currency = "+currency+"]";
}
}