* @return a reference to the {@code Element} that contains the marshaled SAML assertion.
* @throws Exception if an error occurs while marshaling the assertion.
*/
public static Element toElement(SAML11AssertionType assertion) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SAML11AssertionWriter writer = new SAML11AssertionWriter(StaxUtil.getXMLStreamWriter(baos));
writer.write(assertion);
ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
Document document = DocumentUtil.getDocument(bis);
return document.getDocumentElement();