Code example for DOMImplementationLS

Methods: createLSOutputcreateLSSerializer

0
			Element element = marshaller.marshall(xmlObject);
 
			ByteArrayOutputStream byteArrayOutputStrm = new ByteArrayOutputStream();
			DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
			DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
			LSSerializer writer = impl.createLSSerializer();
			LSOutput output = impl.createLSOutput();
			output.setByteStream(byteArrayOutputStrm);
			writer.write(element, output);
			return byteArrayOutputStrm.toString();
		} catch (Exception e) {
			log.error("Error Serializing the SAML Response");
			throw new SAML2SSOUIAuthenticatorException("Error Serializing the SAML Response", e);
		} 
	} 
 
	/** 
	 * Compressing and Encoding the response 
	 *  
	 * @param xmlString