You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by br...@apache.org on 2007/03/30 14:56:07 UTC

svn commit: r524108 - /incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java

Author: bravi
Date: Fri Mar 30 07:56:07 2007
New Revision: 524108

URL: http://svn.apache.org/viewvc?view=rev&rev=524108
Log:
[YOKO-329] - Changed the getXMLSchemaType method to fetch the schema type from XmlSchemaCollection.

Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java?view=diff&rev=524108&r1=524107&r2=524108
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/utils/CorbaUtils.java Fri Mar 30 07:56:07 2007
@@ -56,7 +56,7 @@
 import org.apache.schemas.yoko.bindings.corba.Unionbranch;
 
 import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaExternal;
 import org.apache.ws.commons.schema.XmlSchemaForm;
 import org.apache.ws.commons.schema.XmlSchemaType;
@@ -455,33 +455,11 @@
         return result;
     }
 
-    //Change this method to access the XmlSchemaCollection.
     public static XmlSchemaType getXmlSchemaType(ServiceInfo serviceInfo, QName name) {
+        XmlSchemaType result = null;
         if ((name != null) && (serviceInfo != null)) {
-            Iterator<SchemaInfo> it = serviceInfo.getSchemas().iterator();
-            while (it.hasNext()) {
-                XmlSchema schema = it.next().getSchema();
-                return getXmlSchemaType(schema, name);
-            }
-        }
-        return null;
-    }
-
-    //Change this method to access the XmlSchemaCollection.    
-    private static XmlSchemaType getXmlSchemaType(XmlSchema schema, QName name) {
-        XmlSchemaType result = schema.getTypeByName(name);
-        if (result == null) {
-            XmlSchemaElement el = schema.getElementByName(name);
-            if (el != null) {
-                result = el.getSchemaType();
-            }
-            if (result == null) {
-                Iterator it = schema.getIncludes().getIterator();
-                while (it.hasNext()) {
-                    XmlSchemaExternal extSchema = (XmlSchemaExternal) it.next();
-                    return getXmlSchemaType(extSchema.getSchema(), name);
-                }
-            }
+            XmlSchemaCollection col = serviceInfo.getXmlSchemaCollection();
+            result = col.getTypeByQName(name);
         }
         return result;
     }