You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/10/07 05:37:28 UTC

svn commit: r306990 - /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java

Author: chinthaka
Date: Thu Oct  6 20:37:22 2005
New Revision: 306990

URL: http://svn.apache.org/viewcvs?rev=306990&view=rev
Log:
No need to concat all schema elements in to one as the types element can contain more than schema elements

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java?rev=306990&r1=306989&r2=306990&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java Thu Oct  6 20:37:22 2005
@@ -6,6 +6,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 import org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension;
 import org.apache.commons.logging.Log;
@@ -84,29 +85,16 @@
 
             ZipEntry entry;
             String entryName = "";
-            OMElement schemaElement = null;
+            OMElement typesElement = OMAbstractFactory.getOMFactory().createOMElement("types", null);
             while ((entry = zipInputStream.getNextEntry()) != null) {
                 entryName = entry.getName();
                 if (entryName.startsWith(XMLBeansExtension.SCHEMA_FOLDER) && entryName.endsWith(".xsd")) {
-                    InputStream schementry = serviceDescription.getClassLoader().getResourceAsStream(entryName);
-                    StAXOMBuilder builder = new StAXOMBuilder(schementry);
-                    if (schemaElement == null) {
-                        schemaElement = builder.getDocumentElement();
-                    } else {
-                        Iterator children = builder.getDocumentElement().getChildren();
-                        while (children.hasNext()) {
-                            schemaElement.addChild((OMNode) children.next());
-                        }
-                        Iterator allDeclaredNamespaces = builder.getDocumentElement().getAllDeclaredNamespaces();
-                        while (allDeclaredNamespaces.hasNext()) {
-                            OMNamespace omNamespace = (OMNamespace) allDeclaredNamespaces.next();
-                            schemaElement.declareNamespace(omNamespace);
-                        }
-                    }
+                    InputStream schemaEntry = serviceDescription.getClassLoader().getResourceAsStream(entryName);
+                    typesElement.addChild(new StAXOMBuilder(schemaEntry).getDocumentElement());
 
                 }
             }
-            return schemaElement;
+            return typesElement;
         } catch (IOException e) {
             throw new AxisFault(e);
         } catch (XMLStreamException e) {