Java tutorial
//package com.java2s; import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; public class Main { private static Object unmarshal(Class<?> classJAXB, File file) throws Exception { return newUnMarshaller(classJAXB).unmarshal(file); } private static Unmarshaller newUnMarshaller(Class<?> classJAXB) throws Exception { return newContext(classJAXB).createUnmarshaller(); } private static JAXBContext newContext(Class<?> classJAXB) throws Exception { return JAXBContext.newInstance(classJAXB); } }