JAXB how to pass XmlRootElement name at XmlElementRef

Crusy

New Member
I tried to find the solution which will fit in my problem, but with no success.Here is the problem:I have got following part of XML structure (which I have no influence on)\[code\]<users> <array> <item> <username></username> <email></email> </item> ... <item> ... </item> <array></users>\[/code\]I Have following classes structure for that part of XML:\[code\]@XmlRootElement(name = "users")public class XmlUsers extends XmlData{ @XmlElement public XmlArray array;}@XmlRootElement(name = "array")public class XmlArray{ @XmlElementRef(name = "item") public List<XmlItemData> items;}@XmlSeeAlso({ XmlUserData.class })public abstract class XmlItemData{}@XmlRootElementpublic class XmlUserData extends XmlItemData{...}\[/code\]I want to wrap XmlUserData by 'item' or 'user' tags, so I don't want to annotate XmlUserData root element name.How to do this at XmlArray level?As you can see I have tried to name XmlElementRef, but this results in items to be null...
 
Back
Top