Here you can find the source of unmarshal(String xml, Class
public static <T> T unmarshal(String xml, Class<T> c)
//package com.java2s; //License from project: Apache License import java.io.StringReader; import javax.xml.bind.DataBindingException; import javax.xml.bind.JAXB; public class Main { public static <T> T unmarshal(String xml, Class<T> c) { StringReader sr = null;//from w w w . ja va2 s . c o m try { sr = new StringReader(xml.toString()); return JAXB.unmarshal(sr, c); } catch (DataBindingException e) { e.printStackTrace(); return null; } finally { sr.close(); } } }