javax.xml.bind
// Create UnmarshalContext
JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);
// Create Unmarshaller
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
// Unmarshall XML file
File xmlFile = new File("customer.xml");
Customer customer = (Customer) unmarshaller.unmarshal(xmlFile);// Create MarshalContext
JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);
// Create Marshaller
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// Marshal Java object to XML file
File xmlFile = new File("customer.xml");
marshaller.marshal(customer, xmlFile);