You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2011/02/07 12:52:25 UTC

svn commit: r1067924 - in /santuario/xml-security-java/trunk/src: main/java/org/apache/xml/security/resource/ main/java/org/apache/xml/security/transforms/params/ test/resources/

Author: coheigea
Date: Mon Feb  7 11:52:25 2011
New Revision: 1067924

URL: http://svn.apache.org/viewvc?rev=1067924&view=rev
Log:
[SANTUARIO-259,SANTUARIO-257] - Added a log4j properties file from source to test/resources
 - More cleanup of the transforms params code.

Added:
    santuario/xml-security-java/trunk/src/test/resources/log4j.properties
Removed:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/resource/log4j.properties
Modified:
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/InclusiveNamespaces.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer04.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathContainer.java
    santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathFilterCHGPContainer.java

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/InclusiveNamespaces.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/InclusiveNamespaces.java?rev=1067924&r1=1067923&r2=1067924&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/InclusiveNamespaces.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/InclusiveNamespaces.java Mon Feb  7 11:52:25 2011
@@ -16,9 +16,6 @@
  */
 package org.apache.xml.security.transforms.params;
 
-
-
-import java.util.Iterator;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.StringTokenizer;
@@ -30,7 +27,6 @@ import org.apache.xml.security.utils.Ele
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-
 /**
  * This Object serves as Content for the ds:Transforms for exclusive
  * Canonicalization.
@@ -40,139 +36,129 @@ import org.w3c.dom.Element;
  *
  * @author Christian Geuer-Pollmann
  */
-public class InclusiveNamespaces extends ElementProxy
-        implements TransformParam {
+public class InclusiveNamespaces extends ElementProxy implements TransformParam {
 
-   /** Field _TAG_EC_INCLUSIVENAMESPACES */
-   public static final String _TAG_EC_INCLUSIVENAMESPACES =
-      "InclusiveNamespaces";
-
-   /** Field _ATT_EC_PREFIXLIST */
-   public static final String _ATT_EC_PREFIXLIST = "PrefixList";
-
-   /** Field ExclusiveCanonicalizationNamespace */
-   public static final String ExclusiveCanonicalizationNamespace =
-      "http://www.w3.org/2001/10/xml-exc-c14n#";
-
-   /**
-    * Constructor XPathContainer
-    *
-    * @param doc
-    * @param prefixList
-    */
-   public InclusiveNamespaces(Document doc, String prefixList) {
-      this(doc, InclusiveNamespaces.prefixStr2Set(prefixList));
-   }
-
-   /**
-    * Constructor InclusiveNamespaces
-    *
-    * @param doc
-    * @param prefixes
-    */
-   public InclusiveNamespaces(Document doc, Set prefixes) {
-
-      super(doc);
-
-      StringBuffer sb = new StringBuffer();
-      SortedSet prefixList = new TreeSet(prefixes);
-
-
-      Iterator it = prefixList.iterator();
-
-      while (it.hasNext()) {
-         String prefix = (String) it.next();
-
-         if (prefix.equals("xmlns")) {
-            sb.append("#default ");
-         } else {
-            sb.append(prefix + " ");
-         }
-      }
-
-      this.constructionElement
-         .setAttributeNS(null, InclusiveNamespaces._ATT_EC_PREFIXLIST,
-                       sb.toString().trim());
-   }
-
-   /**
-    * Method getInclusiveNamespaces
-    *
-    * @return The Inclusive Namespace string
-    */
-   public String getInclusiveNamespaces() {
-      return this.constructionElement
-         .getAttributeNS(null, InclusiveNamespaces._ATT_EC_PREFIXLIST);
-   }
-
-   /**
-    * Constructor InclusiveNamespaces
-    *
-    * @param element
-    * @param BaseURI
-    * @throws XMLSecurityException
-    */
-   public InclusiveNamespaces(Element element, String BaseURI)
-           throws XMLSecurityException {
-      super(element, BaseURI);
-   }
-
-   /**
-    * Decodes the <code>inclusiveNamespaces</code> String and returns all
-    * selected namespace prefixes as a Set. The <code>#default</code>
-    * namespace token is represented as an empty namespace prefix
-    * (<code>"xmlns"</code>).
-    * <BR/>
-    * The String <code>inclusiveNamespaces=" xenc    ds #default"</code>
-    * is returned as a Set containing the following Strings:
-    * <UL>
-    * <LI><code>xmlns</code></LI>
-    * <LI><code>xenc</code></LI>
-    * <LI><code>ds</code></LI>
-    * </UL>
-    *
-    * @param inclusiveNamespaces
-    * @return A set to string
-    */
-   public static SortedSet prefixStr2Set(String inclusiveNamespaces) {
-
-      SortedSet prefixes = new TreeSet();
-
-      if ((inclusiveNamespaces == null)
-              || (inclusiveNamespaces.length() == 0)) {
-         return prefixes;
-      }
-
-      StringTokenizer st = new StringTokenizer(inclusiveNamespaces, " \t\r\n");
-
-      while (st.hasMoreTokens()) {
-         String prefix = st.nextToken();
-
-         if (prefix.equals("#default")) {
-            prefixes.add("xmlns" );
-         } else {
-            prefixes.add( prefix);
-         }
-      }
-
-      return prefixes;
-   }
-
-   /**
-    * Method getBaseNamespace
-    *
-    * @inheritDoc
-    */
-   public String getBaseNamespace() {
-      return InclusiveNamespaces.ExclusiveCanonicalizationNamespace;
-   }
-
-   /**
-    * Method getBaseLocalName
-    *
-    * @inheritDoc
-    */
-   public String getBaseLocalName() {
-      return InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES;
-   }
+    /** Field _TAG_EC_INCLUSIVENAMESPACES */
+    public static final String _TAG_EC_INCLUSIVENAMESPACES =
+        "InclusiveNamespaces";
+
+    /** Field _ATT_EC_PREFIXLIST */
+    public static final String _ATT_EC_PREFIXLIST = "PrefixList";
+
+    /** Field ExclusiveCanonicalizationNamespace */
+    public static final String ExclusiveCanonicalizationNamespace =
+        "http://www.w3.org/2001/10/xml-exc-c14n#";
+
+    /**
+     * Constructor XPathContainer
+     *
+     * @param doc
+     * @param prefixList
+     */
+    public InclusiveNamespaces(Document doc, String prefixList) {
+        this(doc, InclusiveNamespaces.prefixStr2Set(prefixList));
+    }
+
+    /**
+     * Constructor InclusiveNamespaces
+     *
+     * @param doc
+     * @param prefixes
+     */
+    public InclusiveNamespaces(Document doc, Set<String> prefixes) {
+        super(doc);
+
+        StringBuilder sb = new StringBuilder();
+        SortedSet<String> prefixList = new TreeSet<String>(prefixes);
+
+        for (String prefix : prefixList) {
+            if (prefix.equals("xmlns")) {
+                sb.append("#default ");
+            } else {
+                sb.append(prefix + " ");
+            }
+        }
+        
+        this.constructionElement.setAttributeNS(
+            null, InclusiveNamespaces._ATT_EC_PREFIXLIST, sb.toString().trim());
+    }
+
+    /**
+     * Constructor InclusiveNamespaces
+     *
+     * @param element
+     * @param BaseURI
+     * @throws XMLSecurityException
+     */
+    public InclusiveNamespaces(Element element, String BaseURI)
+        throws XMLSecurityException {
+        super(element, BaseURI);
+    }
+
+    /**
+     * Method getInclusiveNamespaces
+     *
+     * @return The Inclusive Namespace string
+     */
+    public String getInclusiveNamespaces() {
+        return this.constructionElement.getAttributeNS(null, InclusiveNamespaces._ATT_EC_PREFIXLIST);
+    }
+    
+    /**
+     * Decodes the <code>inclusiveNamespaces</code> String and returns all
+     * selected namespace prefixes as a Set. The <code>#default</code>
+     * namespace token is represented as an empty namespace prefix
+     * (<code>"xmlns"</code>).
+     * <BR/>
+     * The String <code>inclusiveNamespaces=" xenc    ds #default"</code>
+     * is returned as a Set containing the following Strings:
+     * <UL>
+     * <LI><code>xmlns</code></LI>
+     * <LI><code>xenc</code></LI>
+     * <LI><code>ds</code></LI>
+     * </UL>
+     *
+     * @param inclusiveNamespaces
+     * @return A set to string
+     */
+    public static SortedSet<String> prefixStr2Set(String inclusiveNamespaces) {
+
+        SortedSet<String> prefixes = new TreeSet<String>();
+
+        if ((inclusiveNamespaces == null) || (inclusiveNamespaces.length() == 0)) {
+            return prefixes;
+        }
+
+        StringTokenizer st = new StringTokenizer(inclusiveNamespaces, " \t\r\n");
+
+        while (st.hasMoreTokens()) {
+            String prefix = st.nextToken();
+
+            if (prefix.equals("#default")) {
+                prefixes.add("xmlns" );
+            } else {
+                prefixes.add(prefix);
+            }
+        }
+
+        return prefixes;
+    }
+
+    /**
+     * Method getBaseNamespace
+     *
+     * @inheritDoc
+     */
+    public String getBaseNamespace() {
+        return InclusiveNamespaces.ExclusiveCanonicalizationNamespace;
+    }
+
+    /**
+     * Method getBaseLocalName
+     *
+     * @inheritDoc
+     */
+    public String getBaseLocalName() {
+        return InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES;
+    }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer.java?rev=1067924&r1=1067923&r2=1067924&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer.java Mon Feb  7 11:52:25 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.xml.security.transforms.params;
 
-
-
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.transforms.TransformParam;
 import org.apache.xml.security.utils.ElementProxy;
@@ -28,7 +26,6 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-
 /**
  * Implements the parameters for the <A
  * HREF="http://www.w3.org/TR/xmldsig-filter2/">XPath Filter v2.0</A>.
@@ -37,275 +34,254 @@ import org.w3c.dom.NodeList;
  * @see <A HREF="http://www.w3.org/TR/xmldsig-filter2/">XPath Filter v2.0 (TR)</A>
  * @see <A HREF="http://www.w3.org/Signature/Drafts/xmldsig-xfilter2/">XPath Filter v2.0 (editors copy)</A>
  */
-public class XPath2FilterContainer extends ElementProxy
-        implements TransformParam {
+public class XPath2FilterContainer extends ElementProxy implements TransformParam {
 
-   /** Field _ATT_FILTER */
-   private static final String _ATT_FILTER = "Filter";
+    /** Field _ATT_FILTER */
+    private static final String _ATT_FILTER = "Filter";
 
-   /** Field _ATT_FILTER_VALUE_INTERSECT */
-   private static final String _ATT_FILTER_VALUE_INTERSECT = "intersect";
+    /** Field _ATT_FILTER_VALUE_INTERSECT */
+    private static final String _ATT_FILTER_VALUE_INTERSECT = "intersect";
 
-   /** Field _ATT_FILTER_VALUE_SUBTRACT */
-   private static final String _ATT_FILTER_VALUE_SUBTRACT = "subtract";
-
-   /** Field _ATT_FILTER_VALUE_UNION */
-   private static final String _ATT_FILTER_VALUE_UNION = "union";
-
-   /** Field INTERSECT */
-   public static final String INTERSECT =
-      XPath2FilterContainer._ATT_FILTER_VALUE_INTERSECT;
-
-   /** Field SUBTRACT */
-   public static final String SUBTRACT =
-      XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT;
-
-   /** Field UNION */
-   public static final String UNION =
-      XPath2FilterContainer._ATT_FILTER_VALUE_UNION;
-
-   /** Field _TAG_XPATH2 */
-   public static final String _TAG_XPATH2 = "XPath";
-
-   /** Field XPathFiler2NS */
-   public static final String XPathFilter2NS =
-      "http://www.w3.org/2002/06/xmldsig-filter2";
-
-   /**
-    * Constructor XPath2FilterContainer
-    *
-    */
-   private XPath2FilterContainer() {
-
-      // no instantiation
-   }
-
-   /**
-    * Constructor XPath2FilterContainer
-    *
-    * @param doc
-    * @param xpath2filter
-    * @param filterType
-    */
-   private XPath2FilterContainer(Document doc, String xpath2filter,
-                                 String filterType) {
-
-      super(doc);
-
-      this.constructionElement
-         .setAttributeNS(null, XPath2FilterContainer._ATT_FILTER, filterType);
-      this.constructionElement.appendChild(doc.createTextNode(xpath2filter));
-   }
-
-   /**
-    * Constructor XPath2FilterContainer
-    *
-    * @param element
-    * @param BaseURI
-    * @throws XMLSecurityException
-    */
-   private XPath2FilterContainer(Element element, String BaseURI)
-           throws XMLSecurityException {
-
-      super(element, BaseURI);
-
-      String filterStr = this.constructionElement.getAttributeNS(null,
-                            XPath2FilterContainer._ATT_FILTER);
-
-      if (!filterStr
-              .equals(XPath2FilterContainer
-              ._ATT_FILTER_VALUE_INTERSECT) &&!filterStr
-                 .equals(XPath2FilterContainer
-                 ._ATT_FILTER_VALUE_SUBTRACT) &&!filterStr
-                    .equals(XPath2FilterContainer._ATT_FILTER_VALUE_UNION)) {
-         Object exArgs[] = { XPath2FilterContainer._ATT_FILTER, filterStr,
-                             XPath2FilterContainer._ATT_FILTER_VALUE_INTERSECT
-                             + ", "
-                             + XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT
-                             + " or "
-                             + XPath2FilterContainer._ATT_FILTER_VALUE_UNION };
-
-         throw new XMLSecurityException("attributeValueIllegal", exArgs);
-      }
-   }
-
-   /**
-    * Creates a new XPath2FilterContainer with the filter type "intersect".
-    *
-    * @param doc
-    * @param xpath2filter
-    * @return the filter.
-    */
-   public static XPath2FilterContainer newInstanceIntersect(Document doc,
-           String xpath2filter) {
-
-      return new XPath2FilterContainer(doc, xpath2filter,
-                                       XPath2FilterContainer
-                                          ._ATT_FILTER_VALUE_INTERSECT);
-   }
-
-   /**
-    * Creates a new XPath2FilterContainer with the filter type "subtract".
-    *
-    * @param doc
-    * @param xpath2filter
-    * @return the filter.
-    */
-   public static XPath2FilterContainer newInstanceSubtract(Document doc,
-           String xpath2filter) {
-
-      return new XPath2FilterContainer(doc, xpath2filter,
-                                       XPath2FilterContainer
-                                          ._ATT_FILTER_VALUE_SUBTRACT);
-   }
-
-   /**
-    * Creates a new XPath2FilterContainer with the filter type "union".
-    *
-    * @param doc
-    * @param xpath2filter
-    * @return the filter
-    */
-   public static XPath2FilterContainer newInstanceUnion(Document doc,
-           String xpath2filter) {
-
-      return new XPath2FilterContainer(doc, xpath2filter,
-                                       XPath2FilterContainer
-                                          ._ATT_FILTER_VALUE_UNION);
-   }
-
-   /**
-    * Method newInstances
-    *
-    * @param doc
-    * @param params
-    * @return the nodelist with the data
-    */
-   public static NodeList newInstances(Document doc, String[][] params) {
-
-      HelperNodeList nl = new HelperNodeList();
-
-      XMLUtils.addReturnToElement(doc, nl);
-
-      for (int i = 0; i < params.length; i++) {
-         String type = params[i][0];
-         String xpath = params[i][1];
-
-         if (!(type.equals(XPath2FilterContainer
-                 ._ATT_FILTER_VALUE_INTERSECT) || type
-                    .equals(XPath2FilterContainer
-                    ._ATT_FILTER_VALUE_SUBTRACT) || type
-                       .equals(XPath2FilterContainer
-                          ._ATT_FILTER_VALUE_UNION))) {
-            throw new IllegalArgumentException("The type(" + i + ")=\"" + type
-                                               + "\" is illegal");
-         }
-
-         XPath2FilterContainer c = new XPath2FilterContainer(doc, xpath, type);
-
-         nl.appendChild(c.getElement());
-         XMLUtils.addReturnToElement(doc, nl);
-      }
-
-      return nl;
-   }
-
-   /**
-    * Creates a XPath2FilterContainer from an existing Element; needed for verification.
-    *
-    * @param element
-    * @param BaseURI
-    * @return the filter
-    *
-    * @throws XMLSecurityException
-    */
-   public static XPath2FilterContainer newInstance(
-           Element element, String BaseURI) throws XMLSecurityException {
-      return new XPath2FilterContainer(element, BaseURI);
-   }
-
-   /**
-    * Returns <code>true</code> if the <code>Filter</code> attribute has value "intersect".
-    *
-    * @return <code>true</code> if the <code>Filter</code> attribute has value "intersect".
-    */
-   public boolean isIntersect() {
-
-      return this.constructionElement
-         .getAttributeNS(null, XPath2FilterContainer._ATT_FILTER)
-         .equals(XPath2FilterContainer._ATT_FILTER_VALUE_INTERSECT);
-   }
-
-   /**
-    * Returns <code>true</code> if the <code>Filter</code> attribute has value "subtract".
-    *
-    * @return <code>true</code> if the <code>Filter</code> attribute has value "subtract".
-    */
-   public boolean isSubtract() {
-
-      return this.constructionElement
-         .getAttributeNS(null, XPath2FilterContainer._ATT_FILTER)
-         .equals(XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT);
-   }
-
-   /**
-    * Returns <code>true</code> if the <code>Filter</code> attribute has value "union".
-    *
-    * @return <code>true</code> if the <code>Filter</code> attribute has value "union".
-    */
-   public boolean isUnion() {
-
-      return this.constructionElement
-         .getAttributeNS(null, XPath2FilterContainer._ATT_FILTER)
-         .equals(XPath2FilterContainer._ATT_FILTER_VALUE_UNION);
-   }
-
-   /**
-    * Returns the XPath 2 Filter String
-    *
-    * @return the XPath 2 Filter String
-    */
-   public String getXPathFilterStr() {
-      return this.getTextFromTextChild();
-   }
-
-   /**
-    * Returns the first Text node which contains information from the XPath 2
-    * Filter String. We must use this stupid hook to enable the here() function
-    * to work.
-    *
-    * $todo$ I dunno whether this crashes: <XPath> here()<!-- comment -->/ds:Signature[1]</XPath>
-    * @return the first Text node which contains information from the XPath 2 Filter String
-    */
-   public Node getXPathFilterTextNode() {
-
-      NodeList children = this.constructionElement.getChildNodes();
-      int length = children.getLength();
-
-      for (int i = 0; i < length; i++) {
-         if (children.item(i).getNodeType() == Node.TEXT_NODE) {
-            return children.item(i);
-         }
-      }
-
-      return null;
-   }
-
-   /**
-    * Method getBaseLocalName
-    *
-    * @return the XPATH2 tag
-    */
-   public final String getBaseLocalName() {
-      return XPath2FilterContainer._TAG_XPATH2;
-   }
-
-   /**
-    * Method getBaseNamespace
-    *
-    * @return XPATH2 tag namespace
-    */
-   public final String getBaseNamespace() {
-      return XPath2FilterContainer.XPathFilter2NS;
-   }
+    /** Field _ATT_FILTER_VALUE_SUBTRACT */
+    private static final String _ATT_FILTER_VALUE_SUBTRACT = "subtract";
+
+    /** Field _ATT_FILTER_VALUE_UNION */
+    private static final String _ATT_FILTER_VALUE_UNION = "union";
+
+    /** Field INTERSECT */
+    public static final String INTERSECT =
+        XPath2FilterContainer._ATT_FILTER_VALUE_INTERSECT;
+
+    /** Field SUBTRACT */
+    public static final String SUBTRACT =
+        XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT;
+
+    /** Field UNION */
+    public static final String UNION =
+        XPath2FilterContainer._ATT_FILTER_VALUE_UNION;
+
+    /** Field _TAG_XPATH2 */
+    public static final String _TAG_XPATH2 = "XPath";
+
+    /** Field XPathFiler2NS */
+    public static final String XPathFilter2NS =
+        "http://www.w3.org/2002/06/xmldsig-filter2";
+
+    /**
+     * Constructor XPath2FilterContainer
+     *
+     */
+    private XPath2FilterContainer() {
+        // no instantiation
+    }
+
+    /**
+     * Constructor XPath2FilterContainer
+     *
+     * @param doc
+     * @param xpath2filter
+     * @param filterType
+     */
+    private XPath2FilterContainer(Document doc, String xpath2filter, String filterType) {
+        super(doc);
+
+        this.constructionElement.setAttributeNS(
+            null, XPath2FilterContainer._ATT_FILTER, filterType);
+        this.constructionElement.appendChild(doc.createTextNode(xpath2filter));
+    }
+
+    /**
+     * Constructor XPath2FilterContainer
+     *
+     * @param element
+     * @param BaseURI
+     * @throws XMLSecurityException
+     */
+    private XPath2FilterContainer(Element element, String BaseURI) throws XMLSecurityException {
+
+        super(element, BaseURI);
+
+        String filterStr = 
+            this.constructionElement.getAttributeNS(null, XPath2FilterContainer._ATT_FILTER);
+
+        if (!filterStr.equals(XPath2FilterContainer._ATT_FILTER_VALUE_INTERSECT) 
+            && !filterStr.equals(XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT) 
+            && !filterStr.equals(XPath2FilterContainer._ATT_FILTER_VALUE_UNION)) {
+            Object exArgs[] = { XPath2FilterContainer._ATT_FILTER, filterStr,
+                                XPath2FilterContainer._ATT_FILTER_VALUE_INTERSECT
+                                + ", "
+                                + XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT
+                                + " or "
+                                + XPath2FilterContainer._ATT_FILTER_VALUE_UNION };
+
+            throw new XMLSecurityException("attributeValueIllegal", exArgs);
+        }
+    }
+
+    /**
+     * Creates a new XPath2FilterContainer with the filter type "intersect".
+     *
+     * @param doc
+     * @param xpath2filter
+     * @return the filter.
+     */
+    public static XPath2FilterContainer newInstanceIntersect(
+        Document doc, String xpath2filter
+    ) {
+        return new XPath2FilterContainer(
+            doc, xpath2filter, XPath2FilterContainer._ATT_FILTER_VALUE_INTERSECT);
+    }
+
+    /**
+     * Creates a new XPath2FilterContainer with the filter type "subtract".
+     *
+     * @param doc
+     * @param xpath2filter
+     * @return the filter.
+     */
+    public static XPath2FilterContainer newInstanceSubtract(Document doc, String xpath2filter) {
+        return new XPath2FilterContainer(
+            doc, xpath2filter, XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT);
+    }
+
+    /**
+     * Creates a new XPath2FilterContainer with the filter type "union".
+     *
+     * @param doc
+     * @param xpath2filter
+     * @return the filter
+     */
+    public static XPath2FilterContainer newInstanceUnion(Document doc, String xpath2filter) {
+        return new XPath2FilterContainer(
+            doc, xpath2filter, XPath2FilterContainer._ATT_FILTER_VALUE_UNION);
+    }
+
+    /**
+     * Method newInstances
+     *
+     * @param doc
+     * @param params
+     * @return the nodelist with the data
+     */
+    public static NodeList newInstances(Document doc, String[][] params) {
+        HelperNodeList nl = new HelperNodeList();
+
+        XMLUtils.addReturnToElement(doc, nl);
+
+        for (int i = 0; i < params.length; i++) {
+            String type = params[i][0];
+            String xpath = params[i][1];
+
+            if (!(type.equals(XPath2FilterContainer._ATT_FILTER_VALUE_INTERSECT) 
+                || type.equals(XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT) 
+                || type.equals(XPath2FilterContainer._ATT_FILTER_VALUE_UNION))) {
+                throw new IllegalArgumentException("The type(" + i + ")=\"" + type
+                                                   + "\" is illegal");
+            }
+
+            XPath2FilterContainer c = new XPath2FilterContainer(doc, xpath, type);
+
+            nl.appendChild(c.getElement());
+            XMLUtils.addReturnToElement(doc, nl);
+        }
+
+        return nl;
+    }
+
+    /**
+     * Creates a XPath2FilterContainer from an existing Element; needed for verification.
+     *
+     * @param element
+     * @param BaseURI
+     * @return the filter
+     *
+     * @throws XMLSecurityException
+     */
+    public static XPath2FilterContainer newInstance(
+        Element element, String BaseURI
+    ) throws XMLSecurityException {
+        return new XPath2FilterContainer(element, BaseURI);
+    }
+
+    /**
+     * Returns <code>true</code> if the <code>Filter</code> attribute has value "intersect".
+     *
+     * @return <code>true</code> if the <code>Filter</code> attribute has value "intersect".
+     */
+    public boolean isIntersect() {
+        return this.constructionElement.getAttributeNS(
+            null, XPath2FilterContainer._ATT_FILTER
+        ).equals(XPath2FilterContainer._ATT_FILTER_VALUE_INTERSECT);
+    }
+
+    /**
+     * Returns <code>true</code> if the <code>Filter</code> attribute has value "subtract".
+     *
+     * @return <code>true</code> if the <code>Filter</code> attribute has value "subtract".
+     */
+    public boolean isSubtract() {
+        return this.constructionElement.getAttributeNS(
+            null, XPath2FilterContainer._ATT_FILTER
+        ).equals(XPath2FilterContainer._ATT_FILTER_VALUE_SUBTRACT);
+    }
+
+    /**
+     * Returns <code>true</code> if the <code>Filter</code> attribute has value "union".
+     *
+     * @return <code>true</code> if the <code>Filter</code> attribute has value "union".
+     */
+    public boolean isUnion() {
+        return this.constructionElement.getAttributeNS(
+            null, XPath2FilterContainer._ATT_FILTER
+        ).equals(XPath2FilterContainer._ATT_FILTER_VALUE_UNION);
+    }
+
+    /**
+     * Returns the XPath 2 Filter String
+     *
+     * @return the XPath 2 Filter String
+     */
+    public String getXPathFilterStr() {
+        return this.getTextFromTextChild();
+    }
+
+    /**
+     * Returns the first Text node which contains information from the XPath 2
+     * Filter String. We must use this stupid hook to enable the here() function
+     * to work.
+     *
+     * $todo$ I dunno whether this crashes: <XPath> here()<!-- comment -->/ds:Signature[1]</XPath>
+     * @return the first Text node which contains information from the XPath 2 Filter String
+     */
+    public Node getXPathFilterTextNode() {
+
+        NodeList children = this.constructionElement.getChildNodes();
+        int length = children.getLength();
+
+        for (int i = 0; i < length; i++) {
+            if (children.item(i).getNodeType() == Node.TEXT_NODE) {
+                return children.item(i);
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Method getBaseLocalName
+     *
+     * @return the XPATH2 tag
+     */
+    public final String getBaseLocalName() {
+        return XPath2FilterContainer._TAG_XPATH2;
+    }
+
+    /**
+     * Method getBaseNamespace
+     *
+     * @return XPATH2 tag namespace
+     */
+    public final String getBaseNamespace() {
+        return XPath2FilterContainer.XPathFilter2NS;
+    }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer04.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer04.java?rev=1067924&r1=1067923&r2=1067924&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer04.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPath2FilterContainer04.java Mon Feb  7 11:52:25 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.xml.security.transforms.params;
 
-
-
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.transforms.TransformParam;
 import org.apache.xml.security.utils.ElementProxy;
@@ -27,7 +25,6 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-
 /**
  * Implements the parameters for the <A
  * HREF="http://www.w3.org/TR/xmldsig-filter2/">XPath Filter v2.0</A>.
@@ -36,228 +33,215 @@ import org.w3c.dom.NodeList;
  * @see <A HREF="http://www.w3.org/TR/xmldsig-filter2/">XPath Filter v2.0 (TR)</A>
  * @see <A HREF="http://www.w3.org/Signature/Drafts/xmldsig-xfilter2/">XPath Filter v2.0 (editors copy)</A>
  */
-public class XPath2FilterContainer04 extends ElementProxy
-        implements TransformParam {
+public class XPath2FilterContainer04 extends ElementProxy implements TransformParam {
 
-   /** Field _ATT_FILTER */
-   private static final String _ATT_FILTER = "Filter";
+    /** Field _ATT_FILTER */
+    private static final String _ATT_FILTER = "Filter";
 
-   /** Field _ATT_FILTER_VALUE_INTERSECT */
-   private static final String _ATT_FILTER_VALUE_INTERSECT = "intersect";
+    /** Field _ATT_FILTER_VALUE_INTERSECT */
+    private static final String _ATT_FILTER_VALUE_INTERSECT = "intersect";
 
-   /** Field _ATT_FILTER_VALUE_SUBTRACT */
-   private static final String _ATT_FILTER_VALUE_SUBTRACT = "subtract";
-
-   /** Field _ATT_FILTER_VALUE_UNION */
-   private static final String _ATT_FILTER_VALUE_UNION = "union";
-
-   /** Field _TAG_XPATH2 */
-   public static final String _TAG_XPATH2 = "XPath";
-
-   /** Field XPathFiler2NS */
-   public static final String XPathFilter2NS =
-      "http://www.w3.org/2002/04/xmldsig-filter2";
-
-   /**
-    * Constructor XPath2FilterContainer04
-    *
-    */
-   private XPath2FilterContainer04() {
-
-      // no instantiation
-   }
-
-   /**
-    * Constructor XPath2FilterContainer04
-    *
-    * @param doc
-    * @param xpath2filter
-    * @param filterType
-    */
-   private XPath2FilterContainer04(Document doc, String xpath2filter,
-                                 String filterType) {
-
-      super(doc);
-
-      this.constructionElement.setAttributeNS(null, XPath2FilterContainer04._ATT_FILTER,
-                                             filterType);
-
-      if ((xpath2filter.length() > 2)
-              && (!Character.isWhitespace(xpath2filter.charAt(0)))) {
-         XMLUtils.addReturnToElement(this.constructionElement);
-         this.constructionElement.appendChild(doc.createTextNode(xpath2filter));
-         XMLUtils.addReturnToElement(this.constructionElement);
-      } else {
-         this.constructionElement
-            .appendChild(doc.createTextNode(xpath2filter));
-      }
-   }
-
-   /**
-    * Constructor XPath2FilterContainer04
-    *
-    * @param element
-    * @param BaseURI
-    * @throws XMLSecurityException
-    */
-   private XPath2FilterContainer04(Element element, String BaseURI)
-           throws XMLSecurityException {
-
-      super(element, BaseURI);
-
-      String filterStr =
-         this.constructionElement
-            .getAttributeNS(null, XPath2FilterContainer04._ATT_FILTER);
-
-      if (!filterStr
-              .equals(XPath2FilterContainer04
-              ._ATT_FILTER_VALUE_INTERSECT) &&!filterStr
-                 .equals(XPath2FilterContainer04
-                 ._ATT_FILTER_VALUE_SUBTRACT) &&!filterStr
-                    .equals(XPath2FilterContainer04._ATT_FILTER_VALUE_UNION)) {
-         Object exArgs[] = { XPath2FilterContainer04._ATT_FILTER, filterStr,
-                             XPath2FilterContainer04._ATT_FILTER_VALUE_INTERSECT
-                             + ", "
-                             + XPath2FilterContainer04._ATT_FILTER_VALUE_SUBTRACT
-                             + " or "
-                             + XPath2FilterContainer04._ATT_FILTER_VALUE_UNION };
-
-         throw new XMLSecurityException("attributeValueIllegal", exArgs);
-      }
-   }
-
-   /**
-    * Creates a new XPath2FilterContainer04 with the filter type "intersect".
-    *
-    * @param doc
-    * @param xpath2filter
-    * @return the instance
-    */
-   public static XPath2FilterContainer04 newInstanceIntersect(Document doc,
-           String xpath2filter) {
-
-      return new XPath2FilterContainer04(doc, xpath2filter,
-                                       XPath2FilterContainer04
-                                          ._ATT_FILTER_VALUE_INTERSECT);
-   }
-
-   /**
-    * Creates a new XPath2FilterContainer04 with the filter type "subtract".
-    *
-    * @param doc
-    * @param xpath2filter
-    * @return the instance
-    */
-   public static XPath2FilterContainer04 newInstanceSubtract(Document doc,
-           String xpath2filter) {
-
-      return new XPath2FilterContainer04(doc, xpath2filter,
-                                       XPath2FilterContainer04
-                                          ._ATT_FILTER_VALUE_SUBTRACT);
-   }
-
-   /**
-    * Creates a new XPath2FilterContainer04 with the filter type "union".
-    *
-    * @param doc
-    * @param xpath2filter
-    * @return the instance
-    */
-   public static XPath2FilterContainer04 newInstanceUnion(Document doc,
-           String xpath2filter) {
-
-      return new XPath2FilterContainer04(doc, xpath2filter,
-                                       XPath2FilterContainer04
-                                          ._ATT_FILTER_VALUE_UNION);
-   }
-
-   /**
-    * Creates a XPath2FilterContainer04 from an existing Element; needed for verification.
-    *
-    * @param element
-    * @param BaseURI
-    * @return the instance
-    *
-    * @throws XMLSecurityException
-    */
-   public static XPath2FilterContainer04 newInstance(
-           Element element, String BaseURI) throws XMLSecurityException {
-      return new XPath2FilterContainer04(element, BaseURI);
-   }
-
-   /**
-    * Returns <code>true</code> if the <code>Filter</code> attribute has value "intersect".
-    *
-    * @return <code>true</code> if the <code>Filter</code> attribute has value "intersect".
-    */
-   public boolean isIntersect() {
-
-      return this.constructionElement
-         .getAttributeNS(null, XPath2FilterContainer04._ATT_FILTER)
-         .equals(XPath2FilterContainer04._ATT_FILTER_VALUE_INTERSECT);
-   }
-
-   /**
-    * Returns <code>true</code> if the <code>Filter</code> attribute has value "subtract".
-    *
-    * @return <code>true</code> if the <code>Filter</code> attribute has value "subtract".
-    */
-   public boolean isSubtract() {
-
-      return this.constructionElement
-         .getAttributeNS(null, XPath2FilterContainer04._ATT_FILTER)
-         .equals(XPath2FilterContainer04._ATT_FILTER_VALUE_SUBTRACT);
-   }
-
-   /**
-    * Returns <code>true</code> if the <code>Filter</code> attribute has value "union".
-    *
-    * @return <code>true</code> if the <code>Filter</code> attribute has value "union".
-    */
-   public boolean isUnion() {
-
-      return this.constructionElement
-         .getAttributeNS(null, XPath2FilterContainer04._ATT_FILTER)
-         .equals(XPath2FilterContainer04._ATT_FILTER_VALUE_UNION);
-   }
-
-   /**
-    * Returns the XPath 2 Filter String
-    *
-    * @return the XPath 2 Filter String
-    */
-   public String getXPathFilterStr() {
-      return this.getTextFromTextChild();
-   }
-
-   /**
-    * Returns the first Text node which contains information from the XPath 2
-    * Filter String. We must use this stupid hook to enable the here() function
-    * to work.
-    *
-    * $todo$ I dunno whether this crashes: <XPath> here()<!-- comment -->/ds:Signature[1]</XPath>
-    * @return the first Text node which contains information from the XPath 2 Filter String
-    */
-   public Node getXPathFilterTextNode() {
-      NodeList children = this.constructionElement.getChildNodes();
-      int length = children.getLength();
-
-      for (int i = 0; i < length; i++) {
-         if (children.item(i).getNodeType() == Node.TEXT_NODE) {
-            return children.item(i);
-         }
-      }
-
-      return null;
-   }
-
-   /** @inheritDoc */
-   public final String getBaseLocalName() {
-      return XPath2FilterContainer04._TAG_XPATH2;
-   }
-
-   /** @inheritDoc */
-   public final String getBaseNamespace() {
-      return XPath2FilterContainer04.XPathFilter2NS;
-   }
+    /** Field _ATT_FILTER_VALUE_SUBTRACT */
+    private static final String _ATT_FILTER_VALUE_SUBTRACT = "subtract";
+
+    /** Field _ATT_FILTER_VALUE_UNION */
+    private static final String _ATT_FILTER_VALUE_UNION = "union";
+
+    /** Field _TAG_XPATH2 */
+    public static final String _TAG_XPATH2 = "XPath";
+
+    /** Field XPathFiler2NS */
+    public static final String XPathFilter2NS =
+        "http://www.w3.org/2002/04/xmldsig-filter2";
+
+    /**
+     * Constructor XPath2FilterContainer04
+     *
+     */
+    private XPath2FilterContainer04() {
+
+        // no instantiation
+    }
+
+    /**
+     * Constructor XPath2FilterContainer04
+     *
+     * @param doc
+     * @param xpath2filter
+     * @param filterType
+     */
+    private XPath2FilterContainer04(Document doc, String xpath2filter, String filterType) {
+        super(doc);
+
+        this.constructionElement.setAttributeNS(
+            null, XPath2FilterContainer04._ATT_FILTER, filterType);
+
+        if ((xpath2filter.length() > 2)
+            && (!Character.isWhitespace(xpath2filter.charAt(0)))) {
+            XMLUtils.addReturnToElement(this.constructionElement);
+            this.constructionElement.appendChild(doc.createTextNode(xpath2filter));
+            XMLUtils.addReturnToElement(this.constructionElement);
+        } else {
+            this.constructionElement.appendChild(doc.createTextNode(xpath2filter));
+        }
+    }
+
+    /**
+     * Constructor XPath2FilterContainer04
+     *
+     * @param element
+     * @param BaseURI
+     * @throws XMLSecurityException
+     */
+    private XPath2FilterContainer04(Element element, String BaseURI)
+        throws XMLSecurityException {
+
+        super(element, BaseURI);
+
+        String filterStr =
+            this.constructionElement.getAttributeNS(null, XPath2FilterContainer04._ATT_FILTER);
+
+        if (!filterStr.equals(XPath2FilterContainer04._ATT_FILTER_VALUE_INTERSECT) 
+            && !filterStr.equals(XPath2FilterContainer04._ATT_FILTER_VALUE_SUBTRACT) 
+            && !filterStr.equals(XPath2FilterContainer04._ATT_FILTER_VALUE_UNION)) {
+            Object exArgs[] = { XPath2FilterContainer04._ATT_FILTER, filterStr,
+                                XPath2FilterContainer04._ATT_FILTER_VALUE_INTERSECT
+                                + ", "
+                                + XPath2FilterContainer04._ATT_FILTER_VALUE_SUBTRACT
+                                + " or "
+                                + XPath2FilterContainer04._ATT_FILTER_VALUE_UNION };
+
+            throw new XMLSecurityException("attributeValueIllegal", exArgs);
+        }
+    }
+
+    /**
+     * Creates a new XPath2FilterContainer04 with the filter type "intersect".
+     *
+     * @param doc
+     * @param xpath2filter
+     * @return the instance
+     */
+    public static XPath2FilterContainer04 newInstanceIntersect(
+        Document doc, String xpath2filter
+    ) {
+        return new XPath2FilterContainer04(
+            doc, xpath2filter, XPath2FilterContainer04._ATT_FILTER_VALUE_INTERSECT);
+    }
+
+    /**
+     * Creates a new XPath2FilterContainer04 with the filter type "subtract".
+     *
+     * @param doc
+     * @param xpath2filter
+     * @return the instance
+     */
+    public static XPath2FilterContainer04 newInstanceSubtract(
+        Document doc, String xpath2filter
+    ) {
+        return new XPath2FilterContainer04(
+            doc, xpath2filter, XPath2FilterContainer04._ATT_FILTER_VALUE_SUBTRACT);
+    }
+
+    /**
+     * Creates a new XPath2FilterContainer04 with the filter type "union".
+     *
+     * @param doc
+     * @param xpath2filter
+     * @return the instance
+     */
+    public static XPath2FilterContainer04 newInstanceUnion(
+        Document doc, String xpath2filter
+    ) {
+        return new XPath2FilterContainer04(
+            doc, xpath2filter, XPath2FilterContainer04._ATT_FILTER_VALUE_UNION);
+    }
+
+    /**
+     * Creates a XPath2FilterContainer04 from an existing Element; needed for verification.
+     *
+     * @param element
+     * @param BaseURI
+     * @return the instance
+     *
+     * @throws XMLSecurityException
+     */
+    public static XPath2FilterContainer04 newInstance(
+        Element element, String BaseURI
+    ) throws XMLSecurityException {
+        return new XPath2FilterContainer04(element, BaseURI);
+    }
+
+    /**
+     * Returns <code>true</code> if the <code>Filter</code> attribute has value "intersect".
+     *
+     * @return <code>true</code> if the <code>Filter</code> attribute has value "intersect".
+     */
+    public boolean isIntersect() {
+        return this.constructionElement.getAttributeNS(
+            null, XPath2FilterContainer04._ATT_FILTER
+        ).equals(XPath2FilterContainer04._ATT_FILTER_VALUE_INTERSECT);
+    }
+
+    /**
+     * Returns <code>true</code> if the <code>Filter</code> attribute has value "subtract".
+     *
+     * @return <code>true</code> if the <code>Filter</code> attribute has value "subtract".
+     */
+    public boolean isSubtract() {
+        return this.constructionElement.getAttributeNS(
+            null, XPath2FilterContainer04._ATT_FILTER
+        ).equals(XPath2FilterContainer04._ATT_FILTER_VALUE_SUBTRACT);
+    }
+
+    /**
+     * Returns <code>true</code> if the <code>Filter</code> attribute has value "union".
+     *
+     * @return <code>true</code> if the <code>Filter</code> attribute has value "union".
+     */
+    public boolean isUnion() {
+        return this.constructionElement.getAttributeNS(
+            null, XPath2FilterContainer04._ATT_FILTER
+        ).equals(XPath2FilterContainer04._ATT_FILTER_VALUE_UNION);
+    }
+
+    /**
+     * Returns the XPath 2 Filter String
+     *
+     * @return the XPath 2 Filter String
+     */
+    public String getXPathFilterStr() {
+        return this.getTextFromTextChild();
+    }
+
+    /**
+     * Returns the first Text node which contains information from the XPath 2
+     * Filter String. We must use this stupid hook to enable the here() function
+     * to work.
+     *
+     * $todo$ I dunno whether this crashes: <XPath> here()<!-- comment -->/ds:Signature[1]</XPath>
+     * @return the first Text node which contains information from the XPath 2 Filter String
+     */
+    public Node getXPathFilterTextNode() {
+        NodeList children = this.constructionElement.getChildNodes();
+        int length = children.getLength();
+
+        for (int i = 0; i < length; i++) {
+            if (children.item(i).getNodeType() == Node.TEXT_NODE) {
+                return children.item(i);
+            }
+        }
+
+        return null;
+    }
+
+    /** @inheritDoc */
+    public final String getBaseLocalName() {
+        return XPath2FilterContainer04._TAG_XPATH2;
+    }
+
+    /** @inheritDoc */
+    public final String getBaseNamespace() {
+        return XPath2FilterContainer04.XPathFilter2NS;
+    }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathContainer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathContainer.java?rev=1067924&r1=1067923&r2=1067924&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathContainer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathContainer.java Mon Feb  7 11:52:25 2011
@@ -17,7 +17,6 @@
 package org.apache.xml.security.transforms.params;
 
 
-
 import org.apache.xml.security.transforms.TransformParam;
 import org.apache.xml.security.utils.Constants;
 import org.apache.xml.security.utils.SignatureElementProxy;
@@ -25,7 +24,6 @@ import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
 
-
 /**
  * This Object serves both as namespace prefix resolver and as container for
  * the <CODE>ds:XPath</CODE> Element. It implements the {@link org.w3c.dom.Element} interface
@@ -35,45 +33,44 @@ import org.w3c.dom.Text;
  */
 public class XPathContainer extends SignatureElementProxy implements TransformParam {
 
-   /**
-    * Constructor XPathContainer
-    *
-    * @param doc
-    */
-   public XPathContainer(Document doc) {
-      super(doc);
-   }
-
-   /**
-    * Sets the TEXT value of the <CODE>ds:XPath</CODE> Element.
-    *
-    * @param xpath
-    */
-   public void setXPath(String xpath) {
-
-      if (this.constructionElement.getChildNodes() != null) {
-         NodeList nl = this.constructionElement.getChildNodes();
-
-         for (int i = 0; i < nl.getLength(); i++) {
-            this.constructionElement.removeChild(nl.item(i));
-         }
-      }
-
-      Text xpathText = this.doc.createTextNode(xpath);
-      this.constructionElement.appendChild(xpathText);
-   }
-
-   /**
-    * Returns the TEXT value of the <CODE>ds:XPath</CODE> Element.
-    *
-    * @return the TEXT value of the <CODE>ds:XPath</CODE> Element.
-    */
-   public String getXPath() {
-      return this.getTextFromTextChild();
-   }
-
-   /** @inheritDoc */
-   public String getBaseLocalName() {
-      return Constants._TAG_XPATH;
-   }
+    /**
+     * Constructor XPathContainer
+     *
+     * @param doc
+     */
+    public XPathContainer(Document doc) {
+        super(doc);
+    }
+
+    /**
+     * Sets the TEXT value of the <CODE>ds:XPath</CODE> Element.
+     *
+     * @param xpath
+     */
+    public void setXPath(String xpath) {
+        if (this.constructionElement.getChildNodes() != null) {
+            NodeList nl = this.constructionElement.getChildNodes();
+
+            for (int i = 0; i < nl.getLength(); i++) {
+                this.constructionElement.removeChild(nl.item(i));
+            }
+        }
+
+        Text xpathText = this.doc.createTextNode(xpath);
+        this.constructionElement.appendChild(xpathText);
+    }
+
+    /**
+     * Returns the TEXT value of the <CODE>ds:XPath</CODE> Element.
+     *
+     * @return the TEXT value of the <CODE>ds:XPath</CODE> Element.
+     */
+    public String getXPath() {
+        return this.getTextFromTextChild();
+    }
+
+    /** @inheritDoc */
+    public String getBaseLocalName() {
+        return Constants._TAG_XPATH;
+    }
 }

Modified: santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathFilterCHGPContainer.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathFilterCHGPContainer.java?rev=1067924&r1=1067923&r2=1067924&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathFilterCHGPContainer.java (original)
+++ santuario/xml-security-java/trunk/src/main/java/org/apache/xml/security/transforms/params/XPathFilterCHGPContainer.java Mon Feb  7 11:52:25 2011
@@ -17,7 +17,6 @@
 package org.apache.xml.security.transforms.params;
 
 
-
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.transforms.TransformParam;
 import org.apache.xml.security.transforms.Transforms;
@@ -27,291 +26,283 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-
 /**
  * Implements the parameters for a custom Transform which has a better performance
- * thatn the xfilter2.
+ * than the xfilter2.
  *
  * @author $Author$
  */
-public class XPathFilterCHGPContainer extends ElementProxy
-        implements TransformParam {
+public class XPathFilterCHGPContainer extends ElementProxy implements TransformParam {
 
-   /** Field _ATT_FILTER_VALUE_INTERSECT */
-   private static final String _TAG_INCLUDE_BUT_SEARCH = "IncludeButSearch";
+    /** Field _ATT_FILTER_VALUE_INTERSECT */
+    private static final String _TAG_INCLUDE_BUT_SEARCH = "IncludeButSearch";
 
-   /** Field _ATT_FILTER_VALUE_SUBTRACT */
-   private static final String _TAG_EXCLUDE_BUT_SEARCH = "ExcludeButSearch";
+    /** Field _ATT_FILTER_VALUE_SUBTRACT */
+    private static final String _TAG_EXCLUDE_BUT_SEARCH = "ExcludeButSearch";
 
-   /** Field _ATT_FILTER_VALUE_UNION */
-   private static final String _TAG_EXCLUDE = "Exclude";
-
-   /** Field _TAG_XPATHCHGP */
-   public static final String _TAG_XPATHCHGP = "XPathAlternative";
-
-   /** Field _ATT_INCLUDESLASH */
-   public static final String _ATT_INCLUDESLASH = "IncludeSlashPolicy";
-
-   /** Field IncludeSlash           */
-   public static final boolean IncludeSlash = true;
-
-   /** Field ExcludeSlash           */
-   public static final boolean ExcludeSlash = false;
-
-   /**
-    * Constructor XPathFilterCHGPContainer
-    *
-    */
-   private XPathFilterCHGPContainer() {
-
-      // no instantiation
-   }
-
-   /**
-    * Constructor XPathFilterCHGPContainer
-    *
-    * @param doc
-    * @param includeSlashPolicy
-    * @param includeButSearch
-    * @param excludeButSearch
-    * @param exclude
-    */
-   private XPathFilterCHGPContainer(Document doc, boolean includeSlashPolicy,
-                                    String includeButSearch,
-                                    String excludeButSearch, String exclude) {
-
-      super(doc);
-
-      if (includeSlashPolicy) {
-         this.constructionElement
-            .setAttributeNS(null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "true");
-      } else {
-         this.constructionElement
-            .setAttributeNS(null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "false");
-      }
-
-      if ((includeButSearch != null)
-              && (includeButSearch.trim().length() > 0)) {
-         Element includeButSearchElem =
-            ElementProxy.createElementForFamily(doc, this.getBaseNamespace(),
-                                        XPathFilterCHGPContainer
-                                           ._TAG_INCLUDE_BUT_SEARCH);
-
-         includeButSearchElem
-            .appendChild(this.doc
-               .createTextNode(indentXPathText(includeButSearch)));
-         XMLUtils.addReturnToElement(this.constructionElement);
-         this.constructionElement.appendChild(includeButSearchElem);
-      }
-
-      if ((excludeButSearch != null)
-              && (excludeButSearch.trim().length() > 0)) {
-         Element excludeButSearchElem =
-         ElementProxy.createElementForFamily(doc, this.getBaseNamespace(),
-                                        XPathFilterCHGPContainer
-                                           ._TAG_EXCLUDE_BUT_SEARCH);
-
-         excludeButSearchElem
-            .appendChild(this.doc
-               .createTextNode(indentXPathText(excludeButSearch)));
-         XMLUtils.addReturnToElement(this.constructionElement);
-         this.constructionElement.appendChild(excludeButSearchElem);
-      }
-
-      if ((exclude != null) && (exclude.trim().length() > 0)) {
-         Element excludeElem = ElementProxy.createElementForFamily(doc,
-                                  this.getBaseNamespace(),
-                                  XPathFilterCHGPContainer._TAG_EXCLUDE);
-
-         excludeElem
-            .appendChild(this.doc.createTextNode(indentXPathText(exclude)));
-         XMLUtils.addReturnToElement(this.constructionElement);
-         this.constructionElement.appendChild(excludeElem);
-      }
-
-      XMLUtils.addReturnToElement(this.constructionElement);
-   }
-
-   /**
-    * Method indentXPathText
-    *
-    * @param xp
-    * @return the string with enters
-    */
-   static String indentXPathText(String xp) {
-
-      if ((xp.length() > 2) && (!Character.isWhitespace(xp.charAt(0)))) {
-         return "\n" + xp + "\n";
-      } 
-      return xp;
-      
-   }
-
-   /**
-    * Constructor XPathFilterCHGPContainer
-    *
-    * @param element
-    * @param BaseURI
-    * @throws XMLSecurityException
-    */
-   private XPathFilterCHGPContainer(Element element, String BaseURI)
-           throws XMLSecurityException {
-      super(element, BaseURI);
-   }
-
-   /**
-    * Creates a new XPathFilterCHGPContainer; needed for generation.
-    *
-    * @param doc
-    * @param includeSlashPolicy
-    * @param includeButSearch
-    * @param excludeButSearch
-    * @param exclude
-    * @return the created object
-    */
-   public static XPathFilterCHGPContainer getInstance(Document doc,
-           boolean includeSlashPolicy, String includeButSearch,
-           String excludeButSearch, String exclude) {
-
-      return new XPathFilterCHGPContainer(doc, includeSlashPolicy,
-                                          includeButSearch, excludeButSearch,
-                                          exclude);
-   }
-
-   /**
-    * Creates a XPathFilterCHGPContainer from an existing Element; needed for verification.
-    *
-    * @param element
-    * @param BaseURI
-    *
-    * @throws XMLSecurityException
-    * @return the created object.
-    */
-   public static XPathFilterCHGPContainer getInstance(
-           Element element, String BaseURI) throws XMLSecurityException {
-      return new XPathFilterCHGPContainer(element, BaseURI);
-   }
-
-   /**
-    * Method getXStr
-    *
-    * @param type
-    * @return The Xstr
-    */
-   private String getXStr(String type) {
-
-      if (this.length(this.getBaseNamespace(), type) != 1) {
-         return "";
-      }
-
-      Element xElem = XMLUtils.selectNode(this.constructionElement.getFirstChild(), this.getBaseNamespace(),
-                         type,0);
-
-      return XMLUtils.getFullTextChildrenFromElement(xElem);
-   }
-
-   /**
-    * Method getIncludeButSearch
-    *
-    * @return the string
-    */
-   public String getIncludeButSearch() {
-      return this.getXStr(XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH);
-   }
-
-   /**
-    * Method getExcludeButSearch
-    *
-    * @return the string
-    */
-   public String getExcludeButSearch() {
-      return this.getXStr(XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH);
-   }
-
-   /**
-    * Method getExclude
-    *
-    * @return the string
-    */
-   public String getExclude() {
-      return this.getXStr(XPathFilterCHGPContainer._TAG_EXCLUDE);
-   }
-
-   /**
-    * Method getIncludeSlashPolicy
-    *
-    * @return the string
-    */
-   public boolean getIncludeSlashPolicy() {
-
-      return this.constructionElement
-         .getAttributeNS(null, XPathFilterCHGPContainer._ATT_INCLUDESLASH)
-         .equals("true");
-   }
-
-   /**
-    * Returns the first Text node which contains information from the XPath
-    * Filter String. We must use this stupid hook to enable the here() function
-    * to work.
-    *
-    * $todo$ I dunno whether this crashes: <XPath> he<!-- comment -->re()/ds:Signature[1]</XPath>
-    * @param type
-    * @return the first Text node which contains information from the XPath 2 Filter String
-    */
-   private Node getHereContextNode(String type) {
-
-      if (this.length(this.getBaseNamespace(), type) != 1) {
-         return null;
-      }
-
-      return XMLUtils.selectNodeText(this.constructionElement.getFirstChild(), this.getBaseNamespace(),
-                         type,0);
-   }
-
-   /**
-    * Method getHereContextNodeIncludeButSearch
-    *
-    * @return the string
-    */
-   public Node getHereContextNodeIncludeButSearch() {
-      return this
-         .getHereContextNode(XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH);
-   }
-
-   /**
-    * Method getHereContextNodeExcludeButSearch
-    *
-    * @return the string
-    */
-   public Node getHereContextNodeExcludeButSearch() {
-      return this
-         .getHereContextNode(XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH);
-   }
-
-   /**
-    * Method getHereContextNodeExclude
-    *
-    * @return the string
-    */
-   public Node getHereContextNodeExclude() {
-      return this.getHereContextNode(XPathFilterCHGPContainer._TAG_EXCLUDE);
-   }
-
-   /**
-    * Method getBaseLocalName
-    *
-    * @inheritDoc
-    */
-   public final String getBaseLocalName() {
-      return XPathFilterCHGPContainer._TAG_XPATHCHGP;
-   }
-
-   /**
-    * Method getBaseNamespace
-    *
-    * @inheritDoc
-    */
-   public final String getBaseNamespace() {
-      return Transforms.TRANSFORM_XPATHFILTERCHGP;
-   }
+    /** Field _ATT_FILTER_VALUE_UNION */
+    private static final String _TAG_EXCLUDE = "Exclude";
+
+    /** Field _TAG_XPATHCHGP */
+    public static final String _TAG_XPATHCHGP = "XPathAlternative";
+
+    /** Field _ATT_INCLUDESLASH */
+    public static final String _ATT_INCLUDESLASH = "IncludeSlashPolicy";
+
+    /** Field IncludeSlash           */
+    public static final boolean IncludeSlash = true;
+
+    /** Field ExcludeSlash           */
+    public static final boolean ExcludeSlash = false;
+
+    /**
+     * Constructor XPathFilterCHGPContainer
+     *
+     */
+    private XPathFilterCHGPContainer() {
+        // no instantiation
+    }
+
+    /**
+     * Constructor XPathFilterCHGPContainer
+     *
+     * @param doc
+     * @param includeSlashPolicy
+     * @param includeButSearch
+     * @param excludeButSearch
+     * @param exclude
+     */
+    private XPathFilterCHGPContainer(
+        Document doc, boolean includeSlashPolicy, String includeButSearch,
+        String excludeButSearch, String exclude
+    ) {
+        super(doc);
+
+        if (includeSlashPolicy) {
+            this.constructionElement.setAttributeNS(
+                null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "true"
+            );
+        } else {
+            this.constructionElement.setAttributeNS(
+                null, XPathFilterCHGPContainer._ATT_INCLUDESLASH, "false"
+            );
+        }
+
+        if ((includeButSearch != null) && (includeButSearch.trim().length() > 0)) {
+            Element includeButSearchElem =
+                ElementProxy.createElementForFamily(
+                    doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH
+                );
+
+            includeButSearchElem.appendChild(
+                this.doc.createTextNode(indentXPathText(includeButSearch))
+            );
+            XMLUtils.addReturnToElement(this.constructionElement);
+            this.constructionElement.appendChild(includeButSearchElem);
+        }
+
+        if ((excludeButSearch != null) && (excludeButSearch.trim().length() > 0)) {
+            Element excludeButSearchElem =
+                ElementProxy.createElementForFamily(
+                    doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH
+                );
+
+            excludeButSearchElem.appendChild(
+                this.doc.createTextNode(indentXPathText(excludeButSearch)));
+            
+            XMLUtils.addReturnToElement(this.constructionElement);
+            this.constructionElement.appendChild(excludeButSearchElem);
+        }
+
+        if ((exclude != null) && (exclude.trim().length() > 0)) {
+            Element excludeElem = 
+                ElementProxy.createElementForFamily(
+                   doc, this.getBaseNamespace(), XPathFilterCHGPContainer._TAG_EXCLUDE);
+
+            excludeElem.appendChild(this.doc.createTextNode(indentXPathText(exclude)));
+            XMLUtils.addReturnToElement(this.constructionElement);
+            this.constructionElement.appendChild(excludeElem);
+        }
+
+        XMLUtils.addReturnToElement(this.constructionElement);
+    }
+
+    /**
+     * Method indentXPathText
+     *
+     * @param xp
+     * @return the string with enters
+     */
+    static String indentXPathText(String xp) {
+        if ((xp.length() > 2) && (!Character.isWhitespace(xp.charAt(0)))) {
+            return "\n" + xp + "\n";
+        } 
+        return xp;
+    }
+
+    /**
+     * Constructor XPathFilterCHGPContainer
+     *
+     * @param element
+     * @param BaseURI
+     * @throws XMLSecurityException
+     */
+    private XPathFilterCHGPContainer(Element element, String BaseURI)
+        throws XMLSecurityException {
+        super(element, BaseURI);
+    }
+
+    /**
+     * Creates a new XPathFilterCHGPContainer; needed for generation.
+     *
+     * @param doc
+     * @param includeSlashPolicy
+     * @param includeButSearch
+     * @param excludeButSearch
+     * @param exclude
+     * @return the created object
+     */
+    public static XPathFilterCHGPContainer getInstance(
+        Document doc, boolean includeSlashPolicy, String includeButSearch,
+        String excludeButSearch, String exclude
+    ) {
+        return new XPathFilterCHGPContainer(
+            doc, includeSlashPolicy, includeButSearch, excludeButSearch, exclude);
+    }
+
+    /**
+     * Creates a XPathFilterCHGPContainer from an existing Element; needed for verification.
+     *
+     * @param element
+     * @param BaseURI
+     *
+     * @throws XMLSecurityException
+     * @return the created object.
+     */
+    public static XPathFilterCHGPContainer getInstance(
+        Element element, String BaseURI
+    ) throws XMLSecurityException {
+        return new XPathFilterCHGPContainer(element, BaseURI);
+    }
+
+    /**
+     * Method getXStr
+     *
+     * @param type
+     * @return The Xstr
+     */
+    private String getXStr(String type) {
+        if (this.length(this.getBaseNamespace(), type) != 1) {
+            return "";
+        }
+
+        Element xElem = 
+            XMLUtils.selectNode(
+                this.constructionElement.getFirstChild(), this.getBaseNamespace(), type, 0
+            );
+
+        return XMLUtils.getFullTextChildrenFromElement(xElem);
+    }
+
+    /**
+     * Method getIncludeButSearch
+     *
+     * @return the string
+     */
+    public String getIncludeButSearch() {
+        return this.getXStr(XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH);
+    }
+
+    /**
+     * Method getExcludeButSearch
+     *
+     * @return the string
+     */
+    public String getExcludeButSearch() {
+        return this.getXStr(XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH);
+    }
+
+    /**
+     * Method getExclude
+     *
+     * @return the string
+     */
+    public String getExclude() {
+        return this.getXStr(XPathFilterCHGPContainer._TAG_EXCLUDE);
+    }
+
+    /**
+     * Method getIncludeSlashPolicy
+     *
+     * @return the string
+     */
+    public boolean getIncludeSlashPolicy() {
+        return this.constructionElement.getAttributeNS(
+            null, XPathFilterCHGPContainer._ATT_INCLUDESLASH).equals("true");
+    }
+
+    /**
+     * Returns the first Text node which contains information from the XPath
+     * Filter String. We must use this stupid hook to enable the here() function
+     * to work.
+     *
+     * $todo$ I dunno whether this crashes: <XPath> he<!-- comment -->re()/ds:Signature[1]</XPath>
+     * @param type
+     * @return the first Text node which contains information from the XPath 2 Filter String
+     */
+    private Node getHereContextNode(String type) {
+
+        if (this.length(this.getBaseNamespace(), type) != 1) {
+            return null;
+        }
+
+        return XMLUtils.selectNodeText(
+            this.constructionElement.getFirstChild(), this.getBaseNamespace(), type, 0
+        );
+    }
+
+    /**
+     * Method getHereContextNodeIncludeButSearch
+     *
+     * @return the string
+     */
+    public Node getHereContextNodeIncludeButSearch() {
+        return this.getHereContextNode(XPathFilterCHGPContainer._TAG_INCLUDE_BUT_SEARCH);
+    }
+
+    /**
+     * Method getHereContextNodeExcludeButSearch
+     *
+     * @return the string
+     */
+    public Node getHereContextNodeExcludeButSearch() {
+        return this.getHereContextNode(XPathFilterCHGPContainer._TAG_EXCLUDE_BUT_SEARCH);
+    }
+
+    /**
+     * Method getHereContextNodeExclude
+     *
+     * @return the string
+     */
+    public Node getHereContextNodeExclude() {
+        return this.getHereContextNode(XPathFilterCHGPContainer._TAG_EXCLUDE);
+    }
+
+    /**
+     * Method getBaseLocalName
+     *
+     * @inheritDoc
+     */
+    public final String getBaseLocalName() {
+        return XPathFilterCHGPContainer._TAG_XPATHCHGP;
+    }
+
+    /**
+     * Method getBaseNamespace
+     *
+     * @inheritDoc
+     */
+    public final String getBaseNamespace() {
+        return Transforms.TRANSFORM_XPATHFILTERCHGP;
+    }
 }

Added: santuario/xml-security-java/trunk/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/resources/log4j.properties?rev=1067924&view=auto
==============================================================================
--- santuario/xml-security-java/trunk/src/test/resources/log4j.properties (added)
+++ santuario/xml-security-java/trunk/src/test/resources/log4j.properties Mon Feb  7 11:52:25 2011
@@ -0,0 +1,28 @@
+# ------------------------------------------------------------------------
+#
+# Logging Configuration
+#
+# ------------------------------------------------------------------------
+#
+log4j.rootCategory=ERROR, LOGTXT
+#log4j.rootCategory=DEBUG, LOGTXT
+
+#
+# Logfile definitions 
+#
+########################################################################
+#Console Log
+log4j.appender.Console=org.apache.log4j.ConsoleAppender
+log4j.appender.Console.Threshold=DEBUG
+log4j.appender.Console.layout=org.apache.log4j.PatternLayout
+log4j.appender.Console.layout.ConversionPattern=%-5p %C{1}:%L - %m\n
+log4j.appender.Console.Target=System.err
+
+#LOGTXT Log
+log4j.appender.LOGTXT=org.apache.log4j.FileAppender
+log4j.appender.LOGTXT.File=target/log.txt
+log4j.appender.LOGTXT.Append=true
+log4j.appender.LOGTXT.Threshold=DEBUG
+log4j.appender.LOGTXT.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGTXT.layout.ConversionPattern=%-5p %C{1}:%L - %m\n
+