Ejemplo n.º 1
0
  /**
   * Returns a String representation of the <code>&lt;saml:Attribute&gt;</code> element.
   *
   * @param includeNS Determines whether or not the namespace qualifier is prepended to the Element
   *     when converted
   * @param declareNS Determines whether or not the namespace is declared within the Element.
   * @return A string containing the valid XML for this element
   */
  public String toString(boolean includeNS, boolean declareNS) {
    StringBuffer result = new StringBuffer(1000);
    String prefix = "";
    String uri = "";
    if (includeNS) {
      prefix = SAMLConstants.ASSERTION_PREFIX;
    }
    if (declareNS) {
      uri = SAMLConstants.assertionDeclareStr;
    }
    result
        .append("<")
        .append(prefix)
        .append("Attribute")
        .append(uri)
        .append(" AttributeName=\"")
        .append(_attributeName)
        .append("\" AttributeNamespace=\"")
        .append(_attributeNameSpace)
        .append("\">\n");

    Iterator iter = _attributeValue.iterator();
    while (iter.hasNext()) {
      result.append(XMLUtils.printAttributeValue((Element) iter.next(), prefix)).append("\n");
    }
    result.append("</").append(prefix).append("Attribute>\n");
    return result.toString();
  }