cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r695835 - in /cxf/trunk/rt: javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java
Date Tue, 16 Sep 2008 12:44:21 GMT
Author: seanoc
Date: Tue Sep 16 05:44:21 2008
New Revision: 695835

URL: http://svn.apache.org/viewvc?rev=695835&view=rev
Log:
Removed further references to NodeList

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

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java?rev=695835&r1=695834&r2=695835&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java (original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java Tue
Sep 16 05:44:21 2008
@@ -24,7 +24,6 @@
 import org.w3c.dom.Attr;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.mozilla.javascript.Context;
 import org.mozilla.javascript.Scriptable;
@@ -176,6 +175,26 @@
     private void establishChildren() {
         if (!childrenWrapped) {
             if (wrappedNode.hasChildNodes()) {
+                children = new JsSimpleDomNode[wrappedNode.getChildNodes().getLength()];
+                Node node = wrappedNode.getFirstChild();
+                int x = 0;
+                while (node != null) {
+                    JsSimpleDomNode prev = null;
+                    if (x > 0) {
+                        prev = (JsSimpleDomNode)children[x - 1]; 
+                    }
+                    children[x] = newObject(node, prev);
+                    if (x > 0) {
+                        children[x - 1].setNext(children[x]);
+                    }                    
+                    node = node.getNextSibling();
+                    x++;
+                }
+                
+   /*             
+                
+                
+                
                 NodeList nodeChildren = wrappedNode.getChildNodes();
                 children = new JsSimpleDomNode[nodeChildren.getLength()];
                 for (int x = 0; x < nodeChildren.getLength(); x++) {
@@ -188,6 +207,7 @@
                         children[x - 1].setNext(children[x]);
                     }
                 }
+                */
             } else {
                 children = new JsSimpleDomNode[0];
             }

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=695835&r1=695834&r2=695835&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
Tue Sep 16 05:44:21 2008
@@ -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;
@@ -37,19 +36,18 @@
     @Override
     protected void parseChildElements(Element e, ParserContext ctx, BeanDefinitionBuilder
bean) {
         List<Element> ps = new ArrayList<Element>();
-        List<Element> prs = new ArrayList<Element>();
-        NodeList children = e.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) {
-            Node n = children.item(i);
-            if (n.getNodeType() == Node.ELEMENT_NODE) {
-                String name = n.getLocalName();
-                if ("Policy".equals(n.getLocalName())) {
-                    ps.add((Element)n);
-                } else if ("PolicyReference".equals(name)) {
-                    prs.add((Element)n);
-                }
-            }
+        List<Element> prs = new ArrayList<Element>();     
+        
+        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(e);
         }
+        
         bean.addPropertyValue("policyElements", ps);
         bean.addPropertyValue("policyReferenceElements", prs);
         



Mime
View raw message