Here you can find the source of parseXml(final Class
@SuppressWarnings("unchecked") public static <K> K parseXml(final Class<K> klass, final Reader xmlReader) throws Exception
//package com.java2s; import java.io.Reader; import javax.xml.bind.JAXBContext; public class Main { @SuppressWarnings("unchecked") public static <K> K parseXml(final Class<K> klass, final Reader xmlReader) throws Exception { JAXBContext context = JAXBContext.newInstance(klass); return (K) context.createUnmarshaller().unmarshal(xmlReader); }//from w w w.j a va 2 s . c om }