cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r731598 - /cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java
Date Mon, 05 Jan 2009 15:25:41 GMT
Author: dkulp
Date: Mon Jan  5 07:25:40 2009
New Revision: 731598

URL: http://svn.apache.org/viewvc?rev=731598&view=rev
Log:
Proper fix for element traversal

Modified:
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java?rev=731598&r1=731597&r2=731598&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java
Mon Jan  5 07:25:40 2009
@@ -22,10 +22,9 @@
 import java.util.List;
 
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.ws.policy.WSPolicyFeature;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.xml.ParserContext;
@@ -39,21 +38,15 @@
         List<Element> ps = new ArrayList<Element>();
         List<Element> prs = new ArrayList<Element>();     
         
-        NodeList children = e.getChildNodes();
-        if (children != null) {
-            for (int i = 0; i < children.getLength(); i++) {
-                Node nd = children.item(i);
-                if (nd.getNodeType() == Node.ELEMENT_NODE) {
-                    Element elem = (Element)nd;
-                    if ("Policy".equals(elem.getLocalName())) {
-                        ps.add(elem);
-                    } else if ("PolicyReference".equals(elem.getLocalName())) {
-                        prs.add(elem);
-                    }   
-                }
+        Element elem = DOMUtils.getFirstElement(e);
+        while (elem != null) {
+            if ("Policy".equals(elem.getLocalName())) {
+                ps.add(elem);
+            } else if ("PolicyReference".equals(elem.getLocalName())) {
+                prs.add(elem);
             }
+            elem = DOMUtils.getNextElement(elem);
         }
-        
         bean.addPropertyValue("policyElements", ps);
         bean.addPropertyValue("policyReferenceElements", prs);
         



Mime
View raw message