Here you can find the source of marshal(Object object)
public static String marshal(Object object)
//package com.java2s; //License from project: Apache License import javax.xml.bind.JAXB; import java.io.StringWriter; public class Main { public static String marshal(Object object) { StringWriter writer = new StringWriter(); JAXB.marshal(object, writer); return writer.toString(); }/*from ww w .j a v a 2 s .c o m*/ }