Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Print Marshaled XML for the Entity object

Employee employee = new Employee()
    .withEmployeeId(123)
    .withDeptId(456)
    .build();

JAXBContext context = JAXBContext.newInstance(Employee.class);
Marshaller marshaller = context.createMarshaller();
marshaller.marshal(employee, System.out); // prints XML for the object

   Like      Feedback     Marshalling  Marshal Object to XML   Object to XML



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner