6
ho un MyBean annotatoCome utilizzare JAXB Marshall/unmarshall una raccolta di MyBean
@XmlRootElement
public class MyBean ...
Marshalling/deserializzazione MyBean w/o problemi, per esempio
JAXBContext jaxbCtx = JAXBContext.newInstance(MyBean.class);
Marshaller m = jaxbCtx.createMarshaller();
m.marshal(myBean, writer);
Come è possibile utilizzare JAXB per eseguire il marshall/unmarshall di una raccolta o di un elenco?
I miei risultati tentativo in questo errore:
javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.internal.SAXException2: unable to marshal type "java.util.ArrayList" as an element because it is missing an @XmlRootElement annotation]
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:304)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:230)