Here you can find the source of getMarshaller(boolean prettyFormat)
private static Marshaller getMarshaller(boolean prettyFormat) throws JAXBException
//package com.java2s; //License from project: Apache License import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; public class Main { private static JAXBContext jxbc; private static Marshaller getMarshaller(boolean prettyFormat) throws JAXBException { Marshaller m = jxbc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, prettyFormat); m.setProperty("com.sun.xml.bind.indentString", " "); return m; }/* w w w . jav a 2 s . c o m*/ }