Java tutorial
//package com.java2s; //License from project: Open Source License import javax.xml.bind.JAXB; import java.io.*; public class Main { /** * Unmarshal an arbitrary object with JAXB. * * @param stream Input stream to read from * @param clazz Class of object */ public static <O> O unmarshal(InputStream stream, Class<O> clazz) throws Exception { return JAXB.unmarshal(stream, clazz); } }