FELIX-4773 : Generated service component xml does not conform to XSD

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1660647 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
index e9dd4ac..3e87158 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
@@ -192,17 +192,20 @@
         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();
     }