Java XML JAXB Marshaller createMarshaller(Object object)

Here you can find the source of createMarshaller(Object object)

Description

create Marshaller

License

Open Source License

Declaration

private static Marshaller createMarshaller(Object object) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

public class Main {
    private static Marshaller createMarshaller(Object object) {
        JAXBContext context;// w w w .j av  a2 s. c o  m
        Marshaller marshaller = null;
        try {
            context = JAXBContext.newInstance(object.getClass());
            marshaller = context.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
            marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
        } catch (JAXBException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return marshaller;
    }
}

Related

  1. createMarshaller()
  2. createMarshaller(Class clazz, Map settings)
  3. createMarshaller(Class clazz)
  4. createMarshaller(JAXBContext context)
  5. createMarshaller(JAXBContext ctx, boolean indent)
  6. createMarshaller(String pack)
  7. getJSIDLMarshaller()
  8. getMarshaller()
  9. getMarshaller()