felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1660647 - /felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
Date Wed, 18 Feb 2015 15:12:31 GMT
Author: cziegeler
Date: Wed Feb 18 15:12:31 2015
New Revision: 1660647

URL: http://svn.apache.org/r1660647
Log:
FELIX-4773 : Generated service component xml does not conform to XSD

Modified:
    felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java

Modified: felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java?rev=1660647&r1=1660646&r2=1660647&view=diff
==============================================================================
--- felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
(original)
+++ felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
Wed Feb 18 15:12:31 2015
@@ -192,17 +192,20 @@ public class ComponentDescriptorIO {
         contentHandler.startDocument();
         contentHandler.startPrefixMapping(PREFIX, namespace);
 
-        // wrapper element to generate well formed xml
-        contentHandler.startElement("", ComponentDescriptorIO.COMPONENTS, ComponentDescriptorIO.COMPONENTS,
new AttributesImpl());
-        IOUtils.newline(contentHandler);
-
+        // wrapper element to generate well formed xml if 0 or more than 1 component
+        if ( components.size() != 1 ) {
+            contentHandler.startElement("", ComponentDescriptorIO.COMPONENTS, ComponentDescriptorIO.COMPONENTS,
new AttributesImpl());
+            IOUtils.newline(contentHandler);
+        }
         for (final ComponentContainer component : components) {
             generateXML(namespace, module, component, contentHandler);
         }
 
         // end wrapper element
-        contentHandler.endElement("", ComponentDescriptorIO.COMPONENTS, ComponentDescriptorIO.COMPONENTS);
-        IOUtils.newline(contentHandler);
+        if ( components.size() != 1 ) {
+            contentHandler.endElement("", ComponentDescriptorIO.COMPONENTS, ComponentDescriptorIO.COMPONENTS);
+            IOUtils.newline(contentHandler);
+        }
         contentHandler.endPrefixMapping(PREFIX);
         contentHandler.endDocument();
     }



Mime
View raw message