public static String toXml(DeploymentDescriptor descriptor) {
        try {

            Marshaller marshaller = getContext().createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
            marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "http://www.jboss.org/jbpm deployment-descriptor.xsd");
            marshaller.setSchema(schema);
            StringWriter stringWriter = new StringWriter();

            // clone the object and cleanup transients
            DeploymentDescriptor clone = ((DeploymentDescriptorImpl) descriptor).clearClone();

            marshaller.marshal(clone, stringWriter);
            String output = stringWriter.toString();

            return output;
        } catch (Exception e) {
            throw new RuntimeException("Unable to generate xml from deployment descriptor", e);
        }
    }
public static String toXml ( DeploymentDescriptor descriptor ) { try { Marshaller marshaller = getContext ( ) . createMarshaller ( ) ; marshaller . setProperty ( Marshaller . JAXB_FORMATTED_OUTPUT , Boolean . TRUE ) ; marshaller . setProperty ( Marshaller . JAXB_SCHEMA_LOCATION , "http://www.jboss.org/jbpm deployment-descriptor.xsd" ) ; marshaller . setSchema ( schema ) ; StringWriter stringWriter = new StringWriter ( ) ; DeploymentDescriptor clone = ( ( DeploymentDescriptorImpl ) descriptor ) . clearClone ( ) ; marshaller . marshal ( clone , stringWriter ) ; String output = stringWriter . toString ( ) ; return output ; } catch ( Exception e ) { throw new RuntimeException ( "Unable to generate xml from deployment descriptor" , e ) ; } }
Serializes descriptor instance to XML
@param descriptor descriptor to be serialized
@return xml representation of descriptor as string