src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


  68      * Constructor InclusiveNamespaces
  69      *
  70      * @param doc
  71      * @param prefixes
  72      */
  73     public InclusiveNamespaces(Document doc, Set<String> prefixes) {
  74         super(doc);
  75 
  76         SortedSet<String> prefixList = null;
  77         if (prefixes instanceof SortedSet<?>) {
  78             prefixList = (SortedSet<String>)prefixes;
  79         } else {
  80             prefixList = new TreeSet<String>(prefixes);
  81         }
  82 
  83         StringBuilder sb = new StringBuilder();
  84         for (String prefix : prefixList) {
  85             if (prefix.equals("xmlns")) {
  86                 sb.append("#default ");
  87             } else {
  88                 sb.append(prefix + " ");
  89             }
  90         }
  91 
  92         this.constructionElement.setAttributeNS(
  93             null, InclusiveNamespaces._ATT_EC_PREFIXLIST, sb.toString().trim());
  94     }
  95 
  96     /**
  97      * Constructor InclusiveNamespaces
  98      *
  99      * @param element
 100      * @param BaseURI
 101      * @throws XMLSecurityException
 102      */
 103     public InclusiveNamespaces(Element element, String BaseURI)
 104         throws XMLSecurityException {
 105         super(element, BaseURI);
 106     }
 107 
 108     /**




  68      * Constructor InclusiveNamespaces
  69      *
  70      * @param doc
  71      * @param prefixes
  72      */
  73     public InclusiveNamespaces(Document doc, Set<String> prefixes) {
  74         super(doc);
  75 
  76         SortedSet<String> prefixList = null;
  77         if (prefixes instanceof SortedSet<?>) {
  78             prefixList = (SortedSet<String>)prefixes;
  79         } else {
  80             prefixList = new TreeSet<String>(prefixes);
  81         }
  82 
  83         StringBuilder sb = new StringBuilder();
  84         for (String prefix : prefixList) {
  85             if (prefix.equals("xmlns")) {
  86                 sb.append("#default ");
  87             } else {
  88                 sb.append(prefix).append(' ');
  89             }
  90         }
  91 
  92         this.constructionElement.setAttributeNS(
  93             null, InclusiveNamespaces._ATT_EC_PREFIXLIST, sb.toString().trim());
  94     }
  95 
  96     /**
  97      * Constructor InclusiveNamespaces
  98      *
  99      * @param element
 100      * @param BaseURI
 101      * @throws XMLSecurityException
 102      */
 103     public InclusiveNamespaces(Element element, String BaseURI)
 104         throws XMLSecurityException {
 105         super(element, BaseURI);
 106     }
 107 
 108     /**