Here you can find the source of unmarshall(Class
@SuppressWarnings("unchecked") public static <CLAZZ> CLAZZ unmarshall(Class<CLAZZ> clazz, String string) throws JAXBException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.StringReader; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; public class Main { @SuppressWarnings("unchecked") public static <CLAZZ> CLAZZ unmarshall(Class<CLAZZ> clazz, String string) throws JAXBException { JAXBContext context = JAXBContext.newInstance(clazz); Unmarshaller um = context.createUnmarshaller(); return (CLAZZ) um.unmarshal(new StringReader(string)); }/* w w w . jav a 2s. com*/ @SuppressWarnings("unchecked") public static <CLAZZ> CLAZZ unmarshall(Class<CLAZZ> clazz, File xml) throws JAXBException, FileNotFoundException { JAXBContext context = JAXBContext.newInstance(clazz); Unmarshaller um = context.createUnmarshaller(); return (CLAZZ) um.unmarshal(new FileReader(xml)); } }