ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r583550 - /ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java
Date Wed, 10 Oct 2007 17:31:18 GMT
Author: vanto
Date: Wed Oct 10 10:31:17 2007
New Revision: 583550

URL: http://svn.apache.org/viewvc?rev=583550&view=rev
Log:
backporting #582554

Modified:
    ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java

Modified: ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java?rev=583550&r1=583549&r2=583550&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java (original)
+++ ode/branches/APACHE_ODE_1.1/utils/src/main/java/org/apache/ode/utils/DOMUtils.java Wed
Oct 10 10:31:17 2007
@@ -333,26 +333,28 @@
      */
     public static Map<String, String> getParentNamespaces(Element el) {
         HashMap<String,String> pref = new HashMap<String,String>();
-        Map mine = getMyNamespaces(el);
+        Map<String,String> mine = getMyNamespaces(el);
         Node n = el.getParentNode();
-        do {
-            if (n instanceof Element) {
-                Element l = (Element) n;
-                NamedNodeMap nnm = l.getAttributes();
-                int len = nnm.getLength();
-                for (int i = 0; i < len; ++i) {
-                    Attr a = (Attr) nnm.item(i);
-                    if (isNSAttribute(a)) {
-                        String key = getNSPrefixFromNSAttr(a);
-                        String uri = a.getValue();
-                        // prefer prefix bindings that are lower down in the tree.
-                        if (pref.containsKey(key) || mine.containsKey(key)) continue;
-                        pref.put(key, uri);
-                    }
-                }
-            }
-            n = n.getParentNode();
-        } while (n != null && n.getNodeType() != Node.DOCUMENT_NODE);
+        if (n != null) {
+	        do {
+	            if (n instanceof Element) {
+	                Element l = (Element) n;
+	                NamedNodeMap nnm = l.getAttributes();
+	                int len = nnm.getLength();
+	                for (int i = 0; i < len; ++i) {
+	                    Attr a = (Attr) nnm.item(i);
+	                    if (isNSAttribute(a)) {
+	                        String key = getNSPrefixFromNSAttr(a);
+	                        String uri = a.getValue();
+	                        // prefer prefix bindings that are lower down in the tree.
+	                        if (pref.containsKey(key) || mine.containsKey(key)) continue;
+	                        pref.put(key, uri);
+	                    }
+	                }
+	            }
+	            n = n.getParentNode();
+	        } while (n != null && n.getNodeType() != Node.DOCUMENT_NODE);
+        }
         return pref;
     }
 



Mime
View raw message