/** {@inheritDoc} */
  protected void marshallAttributes(XMLObject samlObject, Element domElement)
      throws MarshallingException {
    RequestAbstractType req = (RequestAbstractType) samlObject;

    if (req.getVersion() != null) {
      domElement.setAttributeNS(
          null, RequestAbstractType.VERSION_ATTRIB_NAME, req.getVersion().toString());
    }

    if (req.getID() != null) {
      domElement.setAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, req.getID());
      domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true);
    }

    if (req.getVersion() != null) {
      domElement.setAttributeNS(
          null, RequestAbstractType.VERSION_ATTRIB_NAME, req.getVersion().toString());
    }

    if (req.getIssueInstant() != null) {
      String iiStr = Configuration.getSAMLDateFormatter().print(req.getIssueInstant());
      domElement.setAttributeNS(null, RequestAbstractType.ISSUE_INSTANT_ATTRIB_NAME, iiStr);
    }

    if (req.getDestination() != null) {
      domElement.setAttributeNS(
          null, RequestAbstractType.DESTINATION_ATTRIB_NAME, req.getDestination());
    }

    if (req.getConsent() != null) {
      domElement.setAttributeNS(null, RequestAbstractType.CONSENT_ATTRIB_NAME, req.getConsent());
    }
  }
  /** {@inheritDoc} */
  protected void marshallAttributes(XMLObject samlObject, Element domElement)
      throws MarshallingException {
    AuthnStatement authnStatement = (AuthnStatement) samlObject;

    if (authnStatement.getAuthnInstant() != null) {
      String authnInstantStr =
          Configuration.getSAMLDateFormatter().print(authnStatement.getAuthnInstant());
      domElement.setAttributeNS(null, AuthnStatement.AUTHN_INSTANT_ATTRIB_NAME, authnInstantStr);
    }

    if (authnStatement.getSessionIndex() != null) {
      domElement.setAttributeNS(
          null, AuthnStatement.SESSION_INDEX_ATTRIB_NAME, authnStatement.getSessionIndex());
    }

    if (authnStatement.getSessionNotOnOrAfter() != null) {
      String sessionNotOnOrAfterStr =
          Configuration.getSAMLDateFormatter().print(authnStatement.getSessionNotOnOrAfter());
      domElement.setAttributeNS(
          null, AuthnStatement.SESSION_NOT_ON_OR_AFTER_ATTRIB_NAME, sessionNotOnOrAfterStr);
    }
  }