geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r517911 - /geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
Date Tue, 13 Mar 2007 22:17:34 GMT
Author: gnodet
Date: Tue Mar 13 15:17:33 2007
New Revision: 517911

URL: http://svn.apache.org/viewvc?view=rev&rev=517911
Log:
Fix parsing of root "beans" in a namespace.
Not sure why test case were not failing before ...

Modified:
    geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java?view=diff&rev=517911&r1=517910&r2=517911
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2/XBeanBeanDefinitionDocumentReader.java
Tue Mar 13 15:17:33 2007
@@ -24,6 +24,8 @@
 import org.springframework.beans.factory.xml.XmlReaderContext;
 import org.springframework.util.xml.DomUtils;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 public class XBeanBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader
{
 
@@ -59,9 +61,36 @@
                 }
                 throw new RuntimeException(e);
             }
+        } else if (DomUtils.nodeNameEquals(root, "beans")) {
+            NodeList nl = root.getChildNodes();
+            for (int i = 0; i < nl.getLength(); i++) {
+                Node node = nl.item(i);
+                if (node instanceof Element) {
+                    Element ele = (Element) node;
+                    String childNamespaceUri = ele.getNamespaceURI();
+                    if (delegate.isDefaultNamespace(childNamespaceUri)) {
+                        parseDefaultElement(ele, delegate);
+                    }
+                    else {
+                        delegate.parseCustomElement(ele);
+                    }
+                }
+            }
         } else {
             super.parseBeanDefinitions(root, delegate);
         }
     }
     
+    private void parseDefaultElement(Element ele, BeanDefinitionParserDelegate delegate)
{
+        if (DomUtils.nodeNameEquals(ele, IMPORT_ELEMENT)) {
+            importBeanDefinitionResource(ele);
+        }
+        else if (DomUtils.nodeNameEquals(ele, ALIAS_ELEMENT)) {
+            processAliasRegistration(ele);
+        }
+        else if (DomUtils.nodeNameEquals(ele, BEAN_ELEMENT)) {
+            processBeanDefinition(ele, delegate);
+        }
+    }
+
 }



Mime
View raw message