Java Utililty Methods XML JAXB Marshaller

List of utility methods to do XML JAXB Marshaller

Description

The list of methods to do XML JAXB Marshaller are organized into topic(s).

Method

MarshallercreateJAXBMarshaller(JAXBContext jaxbContext)
create JAXB Marshaller
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
jaxbMarshaller.setProperty("com.sun.xml.bind.xmlHeaders", XML_HEADER);
return jaxbMarshaller;
MarshallercreateMarshall(String pkgName)
create Marshall
JAXBContext jaxbCtx = null;
if ((jaxbCtx = marshallContexts.get(pkgName)) == null) {
    jaxbCtx = JAXBContext.newInstance(pkgName);
    marshallContexts.put(pkgName, jaxbCtx);
Marshaller marshaller = jaxbCtx.createMarshaller();
return marshaller;
MarshallercreateMarshaller()
create Marshaller
return getContext().createMarshaller();
MarshallercreateMarshaller(Class clazz, Map settings)
create Marshaller
try {
    JAXBContext jaxbContext = getJaxbContext(clazz);
    Marshaller marshaller = jaxbContext.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
    marshaller.setProperty(Marshaller.JAXB_ENCODING, (String) settings.get(JAXB_ENCODING));
    marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
    return marshaller;
} catch (JAXBException e) {
...
MarshallercreateMarshaller(Class clazz)
create Marshaller
Marshaller marshaller = createJAXBContext(clazz).createMarshaller();
marshallers.put(clazz, marshaller);
return marshaller;
MarshallercreateMarshaller(JAXBContext context)
create Marshaller
try {
    return context.createMarshaller();
} catch (JAXBException e) {
    throw new IllegalStateException(e);
MarshallercreateMarshaller(JAXBContext ctx, boolean indent)
create Marshaller
Marshaller mar = ctx.createMarshaller();
mar.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, indent ? Boolean.TRUE : Boolean.FALSE);
return mar;
MarshallercreateMarshaller(Object object)
create Marshaller
JAXBContext context;
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) {
...
MarshallercreateMarshaller(String pack)
create Marshaller
return createMarshaller(pack, null);
MarshallergetJSIDLMarshaller()
get JSIDL Marshaller
if (jsidlJc == null)
    jsidlJc = JAXBContext.newInstance("org.jts.jsidl.binding");
if (jsidlMarshaller == null)
    jsidlMarshaller = jsidlJc.createMarshaller();
return jsidlMarshaller;