Java tutorial
//package com.java2s; import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; public class Main { public static <T> Object JAXBUnmarshalling(Class insClass, String fileSource) throws JAXBException { JAXBContext jAXBContext = JAXBContext.newInstance(insClass); Unmarshaller unmarshaller = jAXBContext.createUnmarshaller(); File file = new File(fileSource); Object object = unmarshaller.unmarshal(file); return object; } }