Skip to content

Instantly share code, notes, and snippets.

@anildigital
Created June 13, 2016 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anildigital/9b217c76c2ece2695fbc0e7f5831dfef to your computer and use it in GitHub Desktop.
Save anildigital/9b217c76c2ece2695fbc0e7f5831dfef to your computer and use it in GitHub Desktop.
public void convertToXml(AnyObject object)
throws JAXBException, FileNotFoundException
{
JAXBContext contextObj = JAXBContext.newInstance( PnrRetrieveResult.class);
Marshaller marshallerObj = contextObj.createMarshaller();
marshallerObj.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshallerObj.marshal(object, new FileOutputStream( "/tmp/result.xml"));
System.out.println("Done ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment