/** * Marshall the signed document to an output stream * * @param signedDocument * @param os * @throws TransformerException */ public static void marshall(Document signedDocument, OutputStream os) throws TransformerException { TransformerFactory tf = TransformerUtil.getTransformerFactory(); Transformer trans = tf.newTransformer(); trans.transform(DocumentUtil.getXMLSource(signedDocument), new StreamResult(os)); }
/** * Get the Default Transformer * * @return * @throws ConfigurationException */ public static Transformer getTransformer() throws ConfigurationException { Transformer transformer; try { transformer = getTransformerFactory().newTransformer(); } catch (TransformerConfigurationException e) { throw logger.configurationError(e); } catch (TransformerFactoryConfigurationError e) { throw logger.configurationError(e); } transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.INDENT, "no"); return transformer; }