axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r603246 - in /webservices/axis2/trunk/java/modules/adb-codegen: src/org/apache/axis2/schema/SchemaCompiler.java test-resources/testsuite/union2.xsd
Date Tue, 11 Dec 2007 14:03:17 GMT
Author: amilas
Date: Tue Dec 11 06:03:16 2007
New Revision: 603246

URL: http://svn.apache.org/viewvc?rev=603246&view=rev
Log:
fixed an issue with processing the elements with named types

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/union2.xsd

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?rev=603246&r1=603245&r2=603246&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
Tue Dec 11 06:03:16 2007
@@ -645,24 +645,25 @@
             }
 
             // here what we want is to set the schema type name for the element
-            if (referencedElement.getSchemaType() != null) {
-                if (!this.processedElementRefMap.containsKey(referencedElement.getQName())){
-                    if ((referencedElement.getSchemaTypeName() != null)
-                            && this.baseSchemaTypeMap.containsKey(referencedElement.getSchemaTypeName())){
-                       // this element refers to an defined xml schema type
-                       this.processedElementRefMap.put(referencedElement.getQName(),
+            if (referencedElement.getSchemaTypeName() != null){
+                // i.e this element refers to an complex type name
+                if (!this.processedElementRefMap.containsKey(referencedElement.getQName()))
{
+                    if (this.baseSchemaTypeMap.containsKey(referencedElement.getSchemaTypeName()))
{
+                        this.processedElementRefMap.put(referencedElement.getQName(),
                                 this.baseSchemaTypeMap.get(referencedElement.getSchemaTypeName()));
                     } else {
-                        processSchema(referencedElement, referencedElement.getSchemaType(),
resolvedSchema, true);
-                        // if this is an anonomous complex type we have to set this
+                        XmlSchema resolvedTypeSchema = getParentSchema(resolvedSchema,
+                                referencedElement.getSchemaTypeName(),
+                                COMPONENT_TYPE);
+                        XmlSchemaType xmlSchemaType = resolvedTypeSchema.getTypeByName(
+                                referencedElement.getSchemaTypeName().getLocalPart());
+                        processSchema(referencedElement, xmlSchemaType, resolvedTypeSchema,
true);
                         this.processedElementRefMap.put(referencedElement.getQName(),
                                 this.processedTypemap.get(referencedElement.getSchemaTypeName()));
                     }
-
                 }
                 String javaClassName;
-                if ((referencedElement.getSchemaTypeName() != null)
-                        && this.baseSchemaTypeMap.containsKey(referencedElement.getSchemaTypeName()))
{
+                if (this.baseSchemaTypeMap.containsKey(referencedElement.getSchemaTypeName()))
{
                     // here we have to do nothing since we do not generate a name
                 } else {
                     javaClassName = (String) this.processedTypemap.get(referencedElement.getSchemaTypeName());
@@ -671,8 +672,21 @@
                     xsElt.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
                             javaClassName);
                 }
+            } else if (referencedElement.getSchemaType() != null) {
+                if (!this.processedElementRefMap.containsKey(referencedElement.getQName()))
{
 
+                    processSchema(referencedElement, referencedElement.getSchemaType(), resolvedSchema,
true);
+                    // if this is an anonomous complex type we have to set this
+                    this.processedElementRefMap.put(referencedElement.getQName(),
+                            this.processedTypemap.get(referencedElement.getSchemaTypeName()));
 
+                }
+                
+                String javaClassName = (String) this.processedTypemap.get(referencedElement.getSchemaTypeName());
+                referencedElement.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
+                        javaClassName);
+                xsElt.addMetaInfo(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY,
+                        javaClassName);
             }
 
             // schema type name is present but not the schema type object
@@ -2652,11 +2666,11 @@
         boolean isExists = false;
         switch (componetType) {
             case COMPONENT_TYPE : {
-                isExists = (schema.getTypeByName(componentQName) != null);
+                isExists = (schema.getTypeByName(componentQName.getLocalPart()) != null);
                 break;
             }
             case COMPONENT_ELEMENT : {
-                isExists = (schema.getElementByName(componentQName) != null);
+                isExists = (schema.getElementByName(componentQName.getLocalPart()) != null);
                 break;
             }
             case COMPONENT_ATTRIBUTE : {

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/union2.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/union2.xsd?rev=603246&r1=603245&r2=603246&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/union2.xsd (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/union2.xsd Tue
Dec 11 06:03:16 2007
@@ -36,4 +36,14 @@
         <s:union memberTypes="s:date s:dateTime s:gYear s:gYearMonth">
         </s:union>
     </s:simpleType>
+
+    <s:element name="TestElement">
+        <s:complexType>
+            <s:sequence>
+               <s:element name="creationDate" type="s:string"/>
+               <s:element name="CreationDate" type="s:string"/> 
+            </s:sequence>
+        </s:complexType>
+    </s:element>
+
 </s:schema>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message