Java XML JAXB Marshaller marshall(String file, JAXBElement object, Class context)

Here you can find the source of marshall(String file, JAXBElement object, Class context)

Description

marshall

License

Open Source License

Declaration

public static <T> void marshall(String file, JAXBElement<T> object, Class context) throws Exception 

Method Source Code


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

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

import java.io.File;

public class Main {
    public static <T> void marshall(String file, JAXBElement<T> object, Class context) throws Exception {
        JAXBContext ctx = JAXBContext.newInstance(context);
        Marshaller marshaller = ctx.createMarshaller();
        marshaller.marshal(object, new File(file));
    }//  ww w  .  ja v  a2 s .  com
}

Related

  1. marshall(Object obj)
  2. marshall(Object obj, URL schemaURL, Class... classesToBeBound)
  3. marshall(Object toMarshall)
  4. marshall(OutputStream os, JAXBElement element)
  5. marshall(String cntxtPkg, Object obj, OutputStream out)
  6. marshaller(Object o, Class T)
  7. marshaller(Object obj, File file)
  8. marshallerObject(Class c, Object o)
  9. marshallJAXBObject(String namespace, Object o)