@XmlRootElement(name = "toplist")
class toplist {
private String description;
private List<Item> items= new ArrayList<Item>();
@XmlElement(name = "description")
public String getDescription() {...}
public String setDescription() {...}
@XmlElement(name = "item")
@XmlElementWrapper(name = "items")
public List<ChartResultItem> getToplistEntries() {...}
}
class Item {
private String attr1;
private String attr2;
private String attr3;
// getter and setter with
// @XmlAttribute(name = "atter1"), @XmlAttribute(name = "atter2") and etc
}
И xml
<?xml version="1.0" encoding="UTF-8"?>
<toplist>
<description>This is description.</description>
<items>
<item attr1="" attr2="" attr3="">value1</item>
<item attr1="" attr2="" attr3="">value2</item>
<item attr1="" attr2="" attr3="">value3</item>
...
</items>
</toplist>
Как получить значение1, значение2, значение3 и т. Д. В классе Item (от jaxb)?