You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2008/08/22 09:31:03 UTC

svn commit: r687999 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java

Author: cziegeler
Date: Fri Aug 22 00:31:02 2008
New Revision: 687999

URL: http://svn.apache.org/viewvc?rev=687999&view=rev
Log:
FELIX-695 : Inner elements of component might not have a namespace.

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java?rev=687999&r1=687998&r2=687999&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java Fri Aug 22 00:31:02 2008
@@ -59,6 +59,9 @@
     /** Override namespace. */
     protected String overrideNamespace;
 
+    /** Flag for elements inside a component element */
+    protected boolean isComponent = false;
+
 
     // creates an instance with the bundle owning the component descriptor
     // file parsed by this instance
@@ -94,6 +97,16 @@
         {
             uri = overrideNamespace;
         }
+
+        // FELIX-695: however the spec also states that the inner elements
+        // of a component are unqualified, so they don't have
+        // the namespace - we allow both: with or without namespace!
+        if ( this.isComponent && "".equals(uri) )
+        {
+            uri = NAMESPACE_URI;
+        }
+
+        // from now on uri points to the namespace
         if ( NAMESPACE_URI.equals( uri ) )
         {
             try
@@ -102,6 +115,7 @@
                 // 112.4.3 Component Element
                 if ( localName.equals( "component" ) )
                 {
+                    this.isComponent = true;
 
                     // Create a new ComponentMetadata
                     m_currentComponent = new ComponentMetadata();
@@ -235,10 +249,16 @@
             uri = overrideNamespace;
         }
 
+        if ( this.isComponent && "".equals(uri) )
+        {
+            uri = NAMESPACE_URI;
+        }
+
         if ( NAMESPACE_URI.equals( uri ) )
         {
             if ( localName.equals( "component" ) )
             {
+                this.isComponent = false;
                 // When the closing tag for a component is found, the component is validated to check if
                 // the implementation class has been set
                 m_currentComponent.validate();