Here you can find the source of unmarshall(Class
@SuppressWarnings("unchecked") public static <T> String unmarshall(Class<T> c, Object o) throws JAXBException
//package com.java2s; //License from project: Open Source License import java.io.StringWriter; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; public class Main { @SuppressWarnings("unchecked") public static <T> String unmarshall(Class<T> c, Object o) throws JAXBException { JAXBContext ctx = JAXBContext.newInstance(c); Marshaller marshaller = ctx.createMarshaller(); StringWriter entityXml = new StringWriter(); marshaller.marshal(o, entityXml); return entityXml.toString(); }/*from ww w. j a va 2s . com*/ }