How to convert a class into XML with Aegis?
Can´t find tutorials on the web, only random code.
This will save it to a file :
public void saveToXML(YourDomainObject obj) throws JAXBException, IOException {
JAXBContext context = JAXBContext.newInstance(obj.getClass());
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(obj, new FileWriter(new File("filename.xml")));
}
Take a look at http://download.oracle.com/javase/6/docs/api/javax/xml/bind/Marshaller.html for more info what you can use beside serializing it to a file.