public static Element toElement(AssertionType assertion) throws Exception
{
Document document = DocumentUtil.createDocument();
DOMResult result = new DOMResult(document);
Marshaller marshaller = JAXBUtil.getMarshaller("org.jboss.identity.federation.saml.v2.assertion");
marshaller.marshal(new ObjectFactory().createAssertion(assertion), result);
// normalize the document to remove unused namespaces.
// DOMConfiguration docConfig = document.getDomConfig();
// docConfig.setParameter("namespaces", Boolean.TRUE);
// docConfig.setParameter("namespace-declarations", Boolean.FALSE);