Hallo zusammen,
wie kann ich in JAXB eine Liste einlesen?
Folgender Code funktioniert leider nicht, ich bekomme diese Fehlermeldung:
wie kann ich in JAXB eine Liste einlesen?
Folgender Code funktioniert leider nicht, ich bekomme diese Fehlermeldung:
javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.
Code:
JAXBContext jaxbContext = JAXBContext
.newInstance(MyClass.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
List<MyClass> mylist = findAllObjectsFromMyClass();
// output pretty printed
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.marshal(mylist, file);
jaxbMarshaller.marshal(applicationInfo, System.out);