Monday, 24 March 2014

Unmarshaling Using JaxBContext


try  
{
 File file = new File("C:\\file.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);
 Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
 Customer customer = (Customer) jaxbUnmarshaller.unmarshal(file);
 System.out.println(customer);    
}
catch (JAXBException e)
 {
 e.printStackTrace();
  }

No comments:

Post a Comment