I need a little help with JAXB Annotations and I couldn\'t find good doc\'s helping me figure this out.
I have a class that I want to marshal into XML. My Class look
Try this:
@XmlRootElement(name="car")
...
public class Car {
...
@XmlElementWrapper(name="recalls") // this name=... can be omitted, as it
// is the same as the field name
@XmlElement(name="recall")
private ArrayList<Recall> recalls;
}
From the documentation:
XmlElementWrapper: Generates a wrapper element around XML representation. This is primarily intended to be used to produce a wrapper XML element around collections.