Here you can find the source of unmarshal(org.w3c.dom.Element elem, Class> c)
public static Object unmarshal(org.w3c.dom.Element elem, Class<?> c) throws JAXBException
//package com.java2s; //## The MIT License import java.util.concurrent.ConcurrentHashMap; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; public class Main { private static ConcurrentHashMap<Class<?>, JAXBContext> contextMap = new ConcurrentHashMap<Class<?>, JAXBContext>(); public static Object unmarshal(org.w3c.dom.Element elem, Class<?> c) throws JAXBException { Object result = null;/* w w w.ja va 2 s. c o m*/ JAXBContext jc = getContext(c); Unmarshaller um = jc.createUnmarshaller(); result = um.unmarshal(elem); return result; } private static JAXBContext getContext(Class<?> c) throws JAXBException { JAXBContext jc = contextMap.get(c); if (jc == null) { jc = JAXBContext.newInstance(c); contextMap.put(c, jc); } return jc; } }