Example #1
0
    } // getAttributeStatement()

    /*
    ****************************************************************************
    * toDOM()
    ****************************************************************************
    */ /**
    *  This method will make DOM using the specified document.  If any DOM state
    * has been stored with the obj, it will not be used in this method.
    * This method generates a reference-free copy of new DOM.
    * @param oDoc - The document to use for generating DOM
    */
    public Element toDOM(Document oDoc)
    {
        // for this particular toDOM implementation, oDoc must not be null
        if (oDoc == null)
        {
            return null;
        }

        Element oElem = oDoc.createElementNS(Tags.NS_SAML, Tags.TAG_ASSERTION);

        oElem.setAttributeNS(Tags.NS_XMLNS, "xmlns", Tags.NS_SAML);
        oElem.setAttributeNS(Tags.NS_XMLNS, "xmlns:saml", Tags.NS_SAML);
        oElem.setPrefix("saml");
        oElem.setAttributeNS(null, Tags.ATTR_VERSION, "2.0");
        oElem.setAttributeNS(null, Tags.ATTR_ID_CAP, msXmlID);
        oElem.setAttributeNS(null, Tags.ATTR_ISSUEINSTANT, msIssueInstant);

        if (moIssuer != null)
        {
            Element oChildElem = (Element) moIssuer.toDOM(oDoc);
            oElem.appendChild(oChildElem);
        }

        if (moSignature != null)
        {
            Element oChildElem = moSignature.getElement();

            // import the node, we want a copy
            oChildElem = (Element) oDoc.importNode(oChildElem, true);
            oElem.appendChild(oChildElem);
        }

        if (moSubject != null)
        {
            Element oChildElem = (Element) moSubject.toDOM(oDoc);
            oElem.appendChild(oChildElem);
        }

        if (moConditions != null)
        {
            Element oChildElem = (Element) moConditions.toDOM(oDoc);
            oElem.appendChild(oChildElem);
        }

        if (moAttrStatement != null)
        {
            Element oChildElem = (Element) moAttrStatement.toDOM(oDoc);
            oElem.appendChild(oChildElem);
        }

        return oElem;

    } // toDOM()