Code example for DOMImplementationLS

Methods: createLSOutputcreateLSSerializer

            ByteArrayOutputStream byteArrayOutputStrm = new ByteArrayOutputStream();
            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
            DOMImplementationLS impl =
                    (DOMImplementationLS) registry.getDOMImplementation("LS");
            LSSerializer writer = impl.createLSSerializer();
            LSOutput output = impl.createLSOutput();
            writer.write(element, output);
            return byteArrayOutputStrm.toString();
        } catch (Exception e) {
            throw new Exception("Error Serializing the SAML Response", e);
     * Compressing and Encoding the response 
     * @param xmlString String to be encoded 
     * @return compressed and encoded String 
Connect your IDE to all the code out there  Get Codota for Java