Java XML JAXB Marshaller getMarshaller(boolean prettyFormat)

Here you can find the source of getMarshaller(boolean prettyFormat)

Description

get Marshaller

License

Apache License

Declaration

private static Marshaller getMarshaller(boolean prettyFormat) throws JAXBException 

Method Source Code


//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*/
}

Related

  1. createMarshaller(Object object)
  2. createMarshaller(String pack)
  3. getJSIDLMarshaller()
  4. getMarshaller()
  5. getMarshaller()
  6. getMarshaller(Class c)
  7. getMarshaller(Class clazz)
  8. getMarshaller(final String contextPath)
  9. getMarshaller(String jaxbContext, boolean pretty)