unmarshall

JAXB unmarshalling based on sibling elements

I have the following xml fragment (which is outside of my control): <item> <name>Name</name> <category>1</category> <subcategory>2</subcategory> </item> I'd like <subcategory> to be unmarshalled to a class that looks like this: public class SubCategory { private Category parent; private int code; private String name; p...

JAXB: How to unmarshall objects in lists?

Perhaps a stupid question: i have a List of type <Data> which i want to unmarshall into a XML file. This is my class Database containing an ArrayList... @XmlRootElement public class Database { List<Data> records = new ArrayList<Data>(); public List<Data> getRecords() { return records; } public void s...