Here you can find the source of readXmlFileToObj(String path, String packageName)
public static JAXBElement<?> readXmlFileToObj(String path, String packageName) throws JAXBException
//package com.java2s; //License from project: LGPL import javax.xml.bind.*; import java.io.*; public class Main { public static JAXBElement<?> readXmlFileToObj(String path, String packageName) throws JAXBException { File file = new File(path); JAXBContext jContext = JAXBContext.newInstance(packageName); Unmarshaller unmarshaller = jContext.createUnmarshaller(); return (JAXBElement<?>) unmarshaller.unmarshal(file); }// ww w. j a v a2 s .c o m }