Output as XML (Java)

Set up and configure output to XML from your reporting application. You can use the JAXB marshaller to create XML files with Java.


// code snippet starts

Sales data = new Sales("Columbus Arts", 75038, new Date());

//Generate XML data file:
javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(data.getClass());
javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller();
marshaller.marshal(data, new java.io.File("output.xml"));

// code snippet ends

For further information, see the J2SE documentation.