Java tutorial
//package com.java2s; //License from project: Artistic License import javax.xml.bind.JAXB; import java.io.StringReader; public class Main { public static <T> T unmarshal(String xml, Class<T> beanClass) { StringReader reader = new StringReader(xml); return JAXB.unmarshal(reader, beanClass); } }