You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by mu...@apache.org on 2008/08/14 22:34:43 UTC

svn commit: r686024 - /xml/security/trunk/src/org/apache/xml/security/utils/XMLUtils.java

Author: mullan
Date: Thu Aug 14 13:34:42 2008
New Revision: 686024

URL: http://svn.apache.org/viewvc?rev=686024&view=rev
Log:
Fixed bug 45634: Restore XMLUtils.createDSctx method

Modified:
    xml/security/trunk/src/org/apache/xml/security/utils/XMLUtils.java

Modified: xml/security/trunk/src/org/apache/xml/security/utils/XMLUtils.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src/org/apache/xml/security/utils/XMLUtils.java?rev=686024&r1=686023&r2=686024&view=diff
==============================================================================
--- xml/security/trunk/src/org/apache/xml/security/utils/XMLUtils.java (original)
+++ xml/security/trunk/src/org/apache/xml/security/utils/XMLUtils.java Thu Aug 14 13:34:42 2008
@@ -339,6 +339,28 @@
                                        + (npe == null ? "" : npe.getMessage()) + "\"");
     }
     
+    /**
+     * Method createDSctx
+     *
+     * @param doc
+     * @param prefix
+     * @param namespace
+     * @return the element.
+     */
+    public static Element createDSctx(Document doc, String prefix,
+                                      String namespace) {
+
+       if ((prefix == null) || (prefix.trim().length() == 0)) {
+          throw new IllegalArgumentException("You must supply a prefix");
+       }
+
+       Element ctx = doc.createElementNS(null, "namespaceContext");
+
+       ctx.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix.trim(),
+                          namespace);
+
+       return ctx;
+    }
 
    /**
     * Method addReturnToElement