axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r387970 [1/2] - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal: BeanParamWriter.java WrapWriter.java
Date Wed, 22 Mar 2006 23:28:14 GMT
Author: nadiramra
Date: Wed Mar 22 15:28:11 2006
New Revision: 387970

URL: http://svn.apache.org/viewcvs?rev=387970&view=rev
Log:
Format code so more readable - align braces, etc.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java?rev=387970&r1=387969&r2=387970&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java Wed Mar 22 15:28:11 2006
@@ -61,13 +61,13 @@
         {
             HashSet typeSet = new HashSet();
             String typeName;
+            
             for (int i = 0; i < attribs.length; i++)
             {
                 if (!(attribs[i].isSimpleType() || attribs[i].isAnyType()))
-                {
                     typeSet.add(attribs[i].getTypeName());
-                }
             }
+            
             Iterator itr = typeSet.iterator();
             while (itr.hasNext())
             {
@@ -83,35 +83,25 @@
                 if (!typeName.equals(type.getName().getLocalPart()))
                 {
                     writer.write("extern int Axis_DeSerialize_" + typeName
-                            + "(" + typeName
-                            + "* param, IWrapperSoapDeSerializer* pDZ);\n");
+                            + "(" + typeName + "* param, IWrapperSoapDeSerializer* pDZ);\n");
                     writer.write("extern void* Axis_Create_" + typeName + "("
-                            + typeName
-                            + "* pObj, bool bArray = false, int nSize=0);\n");
+                            + typeName + "* pObj, bool bArray = false, int nSize=0);\n");
                     writer.write("extern void Axis_Delete_" + typeName + "("
-                            + typeName
-                            + "* param, bool bArray = false, int nSize=0);\n");
-                    writer.write("extern int Axis_Serialize_"
-                            + typeName
-                            + "("
-                            + typeName
-                            + "* param, IWrapperSoapSerializer* pSZ, bool bArray = false);\n");
-                    writer.write("extern int Axis_GetSize_" + typeName
-                            + "();\n\n");
+                            + typeName + "* param, bool bArray = false, int nSize=0);\n");
+                    writer.write("extern int Axis_Serialize_" + typeName + "("
+                            + typeName + "* param, IWrapperSoapSerializer* pSZ, bool bArray = false);\n");
+                    writer.write("extern int Axis_GetSize_" + typeName + "();\n\n");
                 } 
                 else
                 {
                     writer.write("int Axis_DeSerialize_" + typeName + "("
-                            + typeName
-                            + "* param, IWrapperSoapDeSerializer* pDZ);\n");
+                            + typeName + "* param, IWrapperSoapDeSerializer* pDZ);\n");
                     writer.write("void* Axis_Create_" + typeName + "("
                             + typeName + "* pObj, bool bArray, int nSize);\n");
                     writer.write("void Axis_Delete_" + typeName + "("
                             + typeName + "* param, bool bArray, int nSize);\n");
-                    writer.write("int Axis_Serialize_"
-                                    + typeName
-                                    + "("
-                                    + typeName
+                    writer.write("int Axis_Serialize_" + typeName
+                                    + "(" + typeName
                                     + "* param, IWrapperSoapSerializer* pSZ, bool bArray);\n");
                     writer.write("int Axis_GetSize_" + typeName + "();\n\n");
                 }
@@ -141,10 +131,10 @@
          * Dushshantha: writing getter
          */
         int anyCounter = 0;
+        
         if (type.isArray())
-        {
             return;
-        }
+        
         try
         {
             for (int i = 0; i < attribs.length; i++)
@@ -161,101 +151,222 @@
                     String localMethodName = methodName.substring( 0, methodName.length() - 1);
                     
                     if( localMethodName.equals( classname))
-                    {
                         methodName = localMethodName; 
-                    }
                 }
                 
                 if (attribs[i].isArray())
                 {
                     String parameterTypeName = properParamName;
                     if (!parameterTypeName.endsWith("*"))
-                    {
                         parameterTypeName += " *";
-                    }
+                    
                     writer.write("\n" + parameterTypeName + " " + classname
                             + "::get" + methodName + "()\n{\n");
 
                     writer.write("\t" + "return " + parameterName + " ; \n}\n");
 
                     writer.write("\n" + "void " + classname + "::set"
-                            + methodName + "(" + parameterTypeName
-                            + " pInValue)\n{\n");
+                            + methodName + "(" + parameterTypeName + " pInValue)\n{\n");
 
                     writer.write("\tif(" + parameterName + " == NULL)\n");
                     writer.write("\t{\n");
-                    if (attribs[i].getChoiceElement()||attribs[i].getAllElement())
+                    
+                    if (attribs[i].getChoiceElement() || attribs[i].getAllElement())
                     {
-                        // This is the 'choice' or 'all' route in the code
                         writer.write("\t\t// This object is a 'choice' or 'all', so need to ensure that any\n");
                         writer.write("\t\t// other objects belonging to this union of elements are empty.\n");
                         writer.write("\t\t// NB: Hasn't been implemented yet!\n");
                         writer.write("\t\t" + parameterName + " = new " + type + "_Array();\n");
                     }
                     else
-                    {
                         writer.write("\t\t" + parameterName + " = new " + properParamName + "();\n");
-                    }
                     
                     writer.write("\t}\n");
-                    if (attribs[i].getChoiceElement()||attribs[i].getAllElement())
-                    {
-                        // This is the 'choice' or 'all' route in the code
+                    
+                    if (attribs[i].getChoiceElement() || attribs[i].getAllElement())
                         writer.write("\t" + parameterName + "->clone( *pInValue);\n");
-                    }
                     else
-                    {
                         writer.write("\t" + parameterName + "->clone( *pInValue);\n");
-                    }
+
                     writer.write("}\n");
                 }
-                else
+                else if (isElementNillable(i)  || isElementOptional(i))
                 {
-                    // FJP Nillable vv
-                    if (isElementNillable(i)  || isElementOptional(i))
+                    if (attribs[i].isAnyType())
+                    {                        
+                        anyCounter += 1;
+                        parameterName = parameterName + Integer.toString(anyCounter);
+                    }
+                    
+                    if(attribs[i].getAllElement() || attribs[i].getChoiceElement() )
                     {
-                        if (attribs[i].isAnyType())
-                        {                        
-                            anyCounter += 1;
-                            parameterName = parameterName + Integer.toString(anyCounter);
-                        }
-                        if(attribs[i].getAllElement() || attribs[i].getChoiceElement() )
-                        {
-                            if (isElementNillable(i))
-                                writer.write("\n" + properParamName + " * " + classname
-                                    + "::get" + methodName + "()\n{\n");
-                            else 
-                                writer.write("\n" + properParamName + " " + classname
-                                        + "::get" + methodName + "()\n{\n");
-                        }
-                        
-                        else
-                        {
+                        if (isElementNillable(i))
                             writer.write("\n" + properParamName + " * " + classname
+                                + "::get" + methodName + "()\n{\n");
+                        else 
+                            writer.write("\n" + properParamName + " " + classname
                                     + "::get" + methodName + "()\n{\n");
-                        }
-                        
-                        writer.write("\t" + "return " + parameterName + " ; \n}\n");
-    
-                        if(attribs[i].getAllElement() || attribs[i].getChoiceElement())
-                        {
-                            if (isElementNillable(i))
-                                writer.write("\n" + "void " + classname + "::set"
-                                        + methodName + "(" + properParamName
-                                        + " * pInValue, bool deep)\n{\n");
-                            else
-                                writer.write("\n" + "void " + classname + "::set"
-                                    + methodName + "(" + properParamName
-                                    + " pInValue, bool deep)\n{\n");
-                        }
-                        else
-                        {
+                    }
+                    else
+                    {
+                        writer.write("\n" + properParamName + " * " + classname
+                                + "::get" + methodName + "()\n{\n");
+                    }
+                    
+                    writer.write("\t" + "return " + parameterName + " ; \n}\n");
+
+                    if(attribs[i].getAllElement() || attribs[i].getChoiceElement())
+                    {
+                        if (isElementNillable(i))
                             writer.write("\n" + "void " + classname + "::set"
                                     + methodName + "(" + properParamName
                                     + " * pInValue, bool deep)\n{\n");
+                        else
+                            writer.write("\n" + "void " + classname + "::set"
+                                + methodName + "(" + properParamName
+                                + " pInValue, bool deep)\n{\n");
+                    }
+                    else
+                    {
+                        writer.write("\n" + "void " + classname + "::set"
+                                + methodName + "(" + properParamName
+                                + " * pInValue, bool deep)\n{\n");
+                    }
+                    
+                    writer.write("\tif (" + parameterName + " != NULL)\n");
+                    writer.write("\t{\n");
+                    writer.write("\t\tif (__axis_deepcopy_" + parameterName + ")\n");
+                    writer.write("\t\t{\n");
+                    writer.write("\t\t\tdelete " + parameterName + ";\n");
+                    writer.write("\t\t}\n");
+                    writer.write("\t\t" + parameterName + " = NULL;\n");
+                    writer.write("\t}\n");
+                    writer.write("\tif (pInValue != NULL)\n");
+                    writer.write("\t{\n");
+                    writer.write("\t\tif (deep)\n");
+                    writer.write("\t\t{\n");
+                    
+                    if(attribs[i].getAllElement() || attribs[i].getChoiceElement())
+                    {
+                        if (isElementNillable(i))
+                            writer.write("\t\t\t" + parameterName + " = new " + type + "*();\n");
+                        else
+                            writer.write("\t\t\t" + parameterName + " = new " + type + "();\n");
+                    }
+                    else
+                    {
+                        writer.write("\t\t\t" + parameterName + " = new " + properParamName + "();\n");
+                    }
+                    
+                    writer.write("\t\t\t*" + parameterName + " = *pInValue;\n");
+                    writer.write("\t\t}\n");
+                    writer.write("\t\telse\n");
+                    writer.write("\t\t{\n");
+                    writer.write("\t\t\t" + parameterName + " = pInValue;\n");
+                    writer.write("\t\t}\n");
+                    writer.write("\t}\n");
+                    writer.write("\telse\n");
+                    writer.write("\t{\n");
+                    writer.write("\t\t" + parameterName + " = NULL;\n");
+                    writer.write("\t}\n");
+                    writer.write("\t__axis_deepcopy_" + parameterName + " = deep;\n");
+
+                    if (attribs[i].getChoiceElement())
+                        for (int j = 0; j < attribs.length; j++)
+                        {
+                            if ((attribs[j].getChoiceElement()) && (j != i))
+                            {
+                                writer.write("\t"
+                                        + attribs[j].getParamNameWithoutSymbols()
+                                        + " = NULL ; \n");
+                            }
                         }
-                        
-    
+                    
+                    if (attribs[i].getAllElement())
+                        for (int j = 0; j < attribs.length; j++)
+                        {
+                            if ((attribs[j].getAllElement()) && (j != i))
+                            {
+                                writer.write("\t"
+                                        + attribs[j].getParamNameWithoutSymbols()
+                                        + " = NULL ; \n");
+                            }
+                        }
+
+                    writer.write("}\n");
+                } 
+                else
+                {
+                    /**
+                     * Dushshantha: Write getter
+                     */
+                
+                    if (attribs[i].isAnyType())
+                    {                        
+                        anyCounter += 1;
+                        parameterName = parameterName + Integer.toString(anyCounter);
+                        methodName = methodName + Integer.toString(anyCounter);
+                    }
+
+                    writer.write("\n"
+                            + properParamName + " " + classname + "::get" + methodName
+                            + "()\n{\n");
+
+                    writer.write("\t" + "return " + parameterName + " ; \n}\n");
+
+                    /**
+                     * Dushshantha: Write setter
+                     */
+
+                    writer.write("\n"
+                            + "void " + classname + "::set"
+                            + methodName + "(" + properParamName + " InValue");
+                    
+                    Type attributeType = attribs[i].getType();
+                    
+                    boolean isPointerType = false;
+                    if (attributeType.isSimpleType())
+                        isPointerType = CUtils.isPointerType(CUtils.getclass4qname(attributeType.getBaseType())); 
+                    else
+                        isPointerType = CUtils.isPointerType(getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]));
+                    
+                    if((attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()) 
+                            && (isPointerType || attribs[i].getAllElement() || attribs[i].getChoiceElement()))
+                        writer.write(", bool deep");
+                    
+                    writer.write(")\n{\n");
+                    
+                    if(isPointerType)
+                    {
+                        writer.write("\tif (" + parameterName + " != NULL)\n");
+                        writer.write("\t{\n");
+                        writer.write("\t\tif (__axis_deepcopy_" + parameterName + ")\n");
+                        writer.write("\t\t{\n");
+                        writer.write("\t\t\tdelete [] " + parameterName + ";\n");
+                        writer.write("\t\t}\n");
+                        writer.write("\t\t" + parameterName + " = NULL;\n");
+                        writer.write("\t}\n\n");
+                        writer.write("\tif(InValue != NULL)\n");
+                        writer.write("\t{\n");
+                        writer.write("\t\tif (deep)\n");
+                        writer.write("\t\t{\n");
+                        writer.write("\t\t\t" + parameterName + " = new char[strlen(InValue) + 1];\n");
+                        writer.write("\t\t\tstrcpy(" + parameterName + ", InValue);\n");
+                        writer.write("\t\t}\n");
+                        writer.write("\t\telse\n");
+                        writer.write("\t\t{\n");
+                        writer.write("\t\t\t" + parameterName + " = InValue;\n");
+                        writer.write("\t\t}\n");
+                        writer.write("\t}\n");
+                        writer.write("\telse\n");
+                        writer.write("\t{\n");
+                        writer.write("\t\t" + parameterName + " = NULL;\n");
+                        writer.write("\t}\n");
+                        writer.write("\t__axis_deepcopy_" + parameterName + " = deep;\n");
+                    }
+                    else if ((attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()) 
+                                && (attribs[i].getAllElement() || attribs[i].getChoiceElement()))
+                    {
                         writer.write("\tif (" + parameterName + " != NULL)\n");
                         writer.write("\t{\n");
                         writer.write("\t\tif (__axis_deepcopy_" + parameterName + ")\n");
@@ -264,26 +375,16 @@
                         writer.write("\t\t}\n");
                         writer.write("\t\t" + parameterName + " = NULL;\n");
                         writer.write("\t}\n");
-                        writer.write("\tif (pInValue != NULL)\n");
+                        writer.write("\tif (InValue != NULL)\n");
                         writer.write("\t{\n");
                         writer.write("\t\tif (deep)\n");
                         writer.write("\t\t{\n");
-                        if(attribs[i].getAllElement() || attribs[i].getChoiceElement())
-                        {
-                            if (isElementNillable(i))
-                                writer.write("\t\t\t" + parameterName + " = new " + type + "*();\n");
-                            else
-                                writer.write("\t\t\t" + parameterName + " = new " + type + "();\n");
-                        }
-                        else
-                        {
-                            writer.write("\t\t\t" + parameterName + " = new " + properParamName + "();\n");
-                        }
-                        writer.write("\t\t\t*" + parameterName + " = *pInValue;\n");
+                        writer.write("\t\t\t" + parameterName + " = new " + type + "();\n");
+                        writer.write("\t\t\t*" + parameterName + " = *InValue;\n");
                         writer.write("\t\t}\n");
                         writer.write("\t\telse\n");
                         writer.write("\t\t{\n");
-                        writer.write("\t\t\t" + parameterName + " = pInValue;\n");
+                        writer.write("\t\t\t" + parameterName + " = InValue;\n");
                         writer.write("\t\t}\n");
                         writer.write("\t}\n");
                         writer.write("\telse\n");
@@ -291,172 +392,20 @@
                         writer.write("\t\t" + parameterName + " = NULL;\n");
                         writer.write("\t}\n");
                         writer.write("\t__axis_deepcopy_" + parameterName + " = deep;\n");
-
-    
-                        if (attribs[i].getChoiceElement())
-                        {
-                            for (int j = 0; j < attribs.length; j++)
-                            {
-                                if ((attribs[j].getChoiceElement()) && (j != i))
-                                {
-                                    writer.write("\t"
-                                            + attribs[j].getParamNameWithoutSymbols()
-                                            + " = NULL ; \n");
-                                }
-                            }
-                        }
-                        if (attribs[i].getAllElement())
-                        {
-                            for (int j = 0; j < attribs.length; j++)
-                            {
-                                if ((attribs[j].getAllElement()) && (j != i))
-                                {
-                                    writer.write("\t"
-                                            + attribs[j].getParamNameWithoutSymbols()
-                                            + " = NULL ; \n");
-                                }
-                            }
-                        }
-    
-                        writer.write("}\n");
-                    } 
+                    }
                     else
-                    {
-                        // FJP Nillable ^^
-    
-                        /**
-                         * Dushshantha: Write getter
-                         */
-    
+                        writer.write("\t" + parameterName + " = InValue ; \n");
 
-                    
-                        if (attribs[i].isAnyType())
-                        {                        
-                            anyCounter += 1;
-                            parameterName = parameterName + Integer.toString(anyCounter);
-                            methodName = methodName + Integer.toString(anyCounter);
-                        }
-    
-                        writer.write("\n"
-                                + properParamName
-                                + " " + classname + "::get"
-                                + methodName
-                                + "()\n{\n");
-    
-                        writer.write("\t" + "return "
-                                + parameterName
-                                + " ; \n}\n");
-    
-                        /**
-                         * Dushshantha: Write setter
-                         */
-    
-                        writer.write("\n"
-                                + "void "
-                                + classname
-                                + "::set"
-                                + methodName
-                                + "("
-                                + properParamName
-                                + " InValue");
-                        Type attributeType = attribs[i].getType();
-                        boolean isPointerType = false;
-                        if (attributeType.isSimpleType())
-                        {
-                            isPointerType = CUtils.isPointerType(CUtils.getclass4qname(attributeType.getBaseType())); 
-                        }
-                        else
+                    if (attribs[i].getChoiceElement())
+                        for (int j = 0; j < attribs.length; j++)
                         {
-                            isPointerType = CUtils.isPointerType(getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]));
+                            if ((attribs[j].getChoiceElement()) && (j != i))
+                                writer.write("\t" + attribs[j].getParamNameWithoutSymbols() + " = NULL ; \n");
                         }
-                        if((attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()) && (isPointerType || attribs[i].getAllElement() || attribs[i].getChoiceElement()))
-                        {
-                            writer.write(", bool deep");
-                        }
-                        writer.write(")\n{\n");
-                        
-                        if(isPointerType)
-                        {
-                            writer.write("\tif (" + parameterName + " != NULL)\n");
-                            writer.write("\t{\n");
-                            writer.write("\t\tif (__axis_deepcopy_" + parameterName + ")\n");
-                            writer.write("\t\t{\n");
-                            writer.write("\t\t\tdelete [] " + parameterName + ";\n");
-                            writer.write("\t\t}\n");
-                            writer.write("\t\t" + parameterName + " = NULL;\n");
-                            writer.write("\t}\n\n");
-                            writer.write("\tif(InValue != NULL)\n");
-                            writer.write("\t{\n");
-                            writer.write("\t\tif (deep)\n");
-                            writer.write("\t\t{\n");
-                            writer.write("\t\t\t" + parameterName + " = new char[strlen(InValue) + 1];\n");
-                            writer.write("\t\t\tstrcpy(" + parameterName + ", InValue);\n");
-                            writer.write("\t\t}\n");
-                            writer.write("\t\telse\n");
-                            writer.write("\t\t{\n");
-                            writer.write("\t\t\t" + parameterName + " = InValue;\n");
-                            writer.write("\t\t}\n");
-                            writer.write("\t}\n");
-                            writer.write("\telse\n");
-                            writer.write("\t{\n");
-                            writer.write("\t\t" + parameterName + " = NULL;\n");
-                            writer.write("\t}\n");
-                            writer.write("\t__axis_deepcopy_" + parameterName + " = deep;\n");
-                        }
-                        else if ((attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()) && (attribs[i].getAllElement() || attribs[i].getChoiceElement()))
-                        {
-                            writer.write("\tif (" + parameterName + " != NULL)\n");
-                            writer.write("\t{\n");
-                            writer.write("\t\tif (__axis_deepcopy_" + parameterName + ")\n");
-                            writer.write("\t\t{\n");
-                            writer.write("\t\t\tdelete " + parameterName + ";\n");
-                            writer.write("\t\t}\n");
-                            writer.write("\t\t" + parameterName + " = NULL;\n");
-                            writer.write("\t}\n");
-                            writer.write("\tif (InValue != NULL)\n");
-                            writer.write("\t{\n");
-                            writer.write("\t\tif (deep)\n");
-                            writer.write("\t\t{\n");
-                            writer.write("\t\t\t" + parameterName + " = new " + type + "();\n");
-                            writer.write("\t\t\t*" + parameterName + " = *InValue;\n");
-                            writer.write("\t\t}\n");
-                            writer.write("\t\telse\n");
-                            writer.write("\t\t{\n");
-                            writer.write("\t\t\t" + parameterName + " = InValue;\n");
-                            writer.write("\t\t}\n");
-                            writer.write("\t}\n");
-                            writer.write("\telse\n");
-                            writer.write("\t{\n");
-                            writer.write("\t\t" + parameterName + " = NULL;\n");
-                            writer.write("\t}\n");
-                            writer.write("\t__axis_deepcopy_" + parameterName + " = deep;\n");
-                        }
-                        else
-                        {
-                            writer.write("\t" + parameterName
-                                    + " = InValue ; \n");
-                        }
-    
-                        if (attribs[i].getChoiceElement())
-                        {
-                            for (int j = 0; j < attribs.length; j++)
-                            {
 
-                                
-                                
-                                if ((attribs[j].getChoiceElement()) && (j != i))
-                                {
-                                    writer.write("\t"
-                                            + attribs[j].getParamNameWithoutSymbols()
-                                            + " = NULL ; \n");
-                                }
-                            }
-                        }
-    
-                        writer.write("}\n");
-                    }
+                    writer.write("}\n");
                 }
-            }
+            } // for loop
         } 
         catch (IOException e)
         {
@@ -468,24 +417,18 @@
     private void writeGetSizeGlobalMethod() throws IOException
     {
         writer.write("/*\n");
-        writer.write(" * This static method gives the size of " + classname
-                + " type of object\n");
+        writer.write(" * This static method gives the size of " + classname + " type of object\n");
         writer.write(" */\n");
-        writer.write("int Axis_GetSize_" + classname
-                + "()\n{\n\treturn sizeof(" + classname + ");\n}\n");
+        writer.write("int Axis_GetSize_" + classname + "()\n{\n\treturn sizeof(" + classname + ");\n}\n");
     }
 
     private void writeSerializeGlobalMethod() throws IOException, WrapperFault
     {
         writer.write("/*\n");
-        writer.write(" * This static method serialize a " + classname
-                + " type of object\n");
+        writer.write(" * This static method serialize a " + classname + " type of object\n");
         writer.write(" */\n");
-        writer.write("int Axis_Serialize_"
-                        + classname
-                        + "("
-                        + classname
-                        + "* param, IWrapperSoapSerializer* pSZ, bool bArray = false)\n{\n");
+        writer.write("int Axis_Serialize_" + classname
+                + "(" + classname + "* param, IWrapperSoapSerializer* pSZ, bool bArray = false)\n{\n");
 
         if (attribs.length == 0)
         {
@@ -495,10 +438,10 @@
             {
                 String typeName = extensionBaseAttrib.getTypeName();
                 writer.write("\tpSZ->serializeAsChardata((void*)");
+                
                 if (!CUtils.isPointerType(typeName))
-                {
                     writer.write("&");
-                }
+                
                 writer.write("(param->"
                         + extensionBaseAttrib.getParamNameAsMember()
                         + "), "
@@ -509,6 +452,7 @@
                 System.out.println("Possible error in class " + classname
                         + ": class with no attributes....................");
             }
+            
             writer.write("\treturn AXIS_SUCCESS;\n");
             writer.write("}\n\n");
             return;
@@ -544,22 +488,18 @@
             }
             else
             {
-                //Samisa
                 //remove _Ref sufix and _ prefix in SOAP tag name
                 String soapTagName = attribs[i].getParamName();
                 if (soapTagName.lastIndexOf("_Ref") > -1)
-                {
                     soapTagName = soapTagName.substring(0, soapTagName.lastIndexOf("_Ref"));
-                }
                 
                 if (soapTagName.charAt(0) == '_')
-                {
                     soapTagName = soapTagName.substring(1, soapTagName.length());
-                }
-                //end remove _Ref sufix and _ prefix in SOAP tag name
+
                 Type type = attribs[i].getType();
                 boolean isPointerType = false;
                 String basicType = null;
+                
                 if (!attribs[i].isSimpleType() && type.isSimpleType())
                 {
                     basicType = CUtils.getclass4qname(attribs[i].getType().getBaseType());
@@ -570,15 +510,13 @@
                     basicType = attribs[i].getTypeName();
                     isPointerType = CUtils.isPointerType(attribs[i].getTypeName());
                 }
+                
                 if (isPointerType)
                 {
-                    writer.write("\tif (0 != param->"
-                            + attribs[i].getParamNameAsMember() + ")\n");
+                    writer.write("\tif (0 != param->" + attribs[i].getParamNameAsMember() + ")\n");
                     writer.write("\t\tpSZ->serializeAsAttribute(\""
-                            + soapTagName
-                            + "\", 0, (void*)(param->"
-                            + attribs[i].getParamNameAsMember()
-                            + "), "
+                            + soapTagName + "\", 0, (void*)(param->"
+                            + attribs[i].getParamNameAsMember() + "), "
                             + CUtils.getXSDTypeForBasicType(basicType) + ");\n");
                 }
                 else
@@ -590,6 +528,7 @@
                             + "), "
                             + CUtils.getXSDTypeForBasicType(attribs[i].getTypeName()) + ");\n");
                 }
+                
                 if (!attribs[i].isOptional())
                 {
                     /* This avoid segmentation fault at runtime */
@@ -602,6 +541,7 @@
                 }
             }
         }
+        
         if (type.isFault())
         {
             writer.write("\tif(Axis_URI_" + classname + ")\n\t{\n");
@@ -621,12 +561,9 @@
             {
                 writer.write("\tpSZ->serializeAsChardata((void*)");
                 if (!CUtils.isPointerType(typeName))
-                {
                     writer.write("&");
-                }
-                writer.write("(param->"
-                        + extensionBaseAttrib.getParamNameAsMember()
-                        + "), "
+
+                writer.write("(param->" + extensionBaseAttrib.getParamNameAsMember() + "), "
                         + CUtils.getXSDTypeForBasicType(typeName) + ");\n");
             }
         }
@@ -636,20 +573,14 @@
         boolean firstIfWritten = false;
         int anyCounter = 0; //counter for any types.
         
-        
         for (int i = attributeParamCount; i < attribs.length; i++)
         {
             String namespace = "";
             if (attribs[i].getNsQualified())
-            {
                 namespace = "Axis_URI_" + classname;
-            }
             else
-            {
                 namespace = "NULL";
-            }
             
-            // Dushshantha:
             // if the attribute is a choice following should do
             if (attribs[i].getChoiceElement())
             {
@@ -659,25 +590,15 @@
                     firstIfWritten = true;
                 } 
                 else
-                {
                     writer.write("\telse if");
-                }
 
-                writer.write("(param->" + attribs[i].getParamNameAsMember()
-                        + ")\n\t{\n\t");
+                writer.write("(param->" + attribs[i].getParamNameAsMember() + ")\n\t{\n\t");
             }
  
-            //Chinthana:
             //if the attribute is a 'all' following should do
-
             if (attribs[i].getAllElement())
-            {
                 if (attribs[i].getMinOccurs() == 0)
-                {
-                    writer.write("\tif(param->"
-                            + attribs[i].getParamNameAsMember() + ")\n\t{\n\t");
-                }
-            }
+                    writer.write("\tif(param->" + attribs[i].getParamNameAsMember() + ")\n\t{\n\t");
              
             if (attribs[i].isAnyType())
             {
@@ -686,51 +607,35 @@
             }
             else if (attribs[i].isArray())
             {
-                //if Array
                 if (attribs[i].isSimpleType() || attribs[i].getType().isSimpleType())
                 {
                     String baseTypeName = null;
                     if (!attribs[i].isSimpleType() && attribs[i].getType().isSimpleType())
-                    {
                         baseTypeName = CUtils.getclass4qname(attribs[i].getType().getBaseType());
-                    }
                     else
-                    {
-                        baseTypeName = attribs[i].getTypeName();;
-                    }
-                    writer.write("\tpSZ->serializeBasicArray(param->"
-                        + attribs[i].getParamName()
-                        + ", "
-                        + namespace
-                        + ","
-                        + CUtils.getXSDTypeForBasicType(baseTypeName)
-                        + ", \""
-                        + attribs[i].getParamNameAsSOAPElement()
-                        + "\");\n");
+                        baseTypeName = attribs[i].getTypeName();
+                    
+                    writer.write("\tpSZ->serializeBasicArray(param->" + attribs[i].getParamName()
+                        + ", " + namespace + ","
+                        + CUtils.getXSDTypeForBasicType(baseTypeName) + ", \""
+                        + attribs[i].getParamNameAsSOAPElement() + "\");\n");
                 }
                 else
                 {
                     arrayType = attribs[i].getTypeName();
+                    
                     if (attribs[i].getNsQualified())
-                    {
                         namespace = "Axis_URI_" + arrayType;
-                    }
                     else
-                    {
                         namespace = "NULL";
-                    }
+                    
                     writer.write("\tpSZ->serializeCmplxArray(param->"
-                                    + attribs[i].getParamNameAsMember()
-                                    + ",\n");
-                    writer.write("\t\t\t\t\t\t (void*) Axis_Serialize_"
-                            + arrayType + ",\n");
-                    writer.write("\t\t\t\t\t\t (void*) Axis_Delete_"
-                            + arrayType + ",\n");
-                    writer.write("\t\t\t\t\t\t (void*) Axis_GetSize_"
-                            + arrayType + ",\n");
+                                    + attribs[i].getParamNameAsMember() + ",\n");
+                    writer.write("\t\t\t\t\t\t (void*) Axis_Serialize_" + arrayType + ",\n");
+                    writer.write("\t\t\t\t\t\t (void*) Axis_Delete_" + arrayType + ",\n");
+                    writer.write("\t\t\t\t\t\t (void*) Axis_GetSize_" + arrayType + ",\n");
                     writer.write("\t\t\t\t\t\t \""
-                            + attribs[i].getElementNameAsString() + "\", "
-                            + namespace + ");\n");
+                            + attribs[i].getElementNameAsString() + "\", " + namespace + ");\n");
                 }
             }
             else if (attribs[i].isSimpleType() || attribs[i].getType().isSimpleType())
@@ -738,107 +643,72 @@
                 String typeName = attribs[i].getTypeName();
                 String baseTypeName = null;
                 if (attribs[i].getType().isSimpleType())
-                {
                     baseTypeName = CUtils.getclass4qname (attribs[i].getType().getBaseType ());
-                }
                 else
-                {
                     baseTypeName = typeName;
-                }
                 
                 if (attribs[i].isOptional())
-                {
                     writer.write("\tif (param->" + attribs[i].getParamNameWithoutSymbols() + " != NULL)\n\t\t{\n\t");
-                }
                 
                 if (CUtils.isPointerType(baseTypeName))
                 {
                     writer.write("\t\tpSZ->serializeAsElement(\""
                             + attribs[i].getSOAPElementNameAsString()
-                            + "\", "
-                            + namespace
-                            + ", (void*)(param->"
-                            + attribs[i].getParamNameWithoutSymbols()
-                            + "), "
+                            + "\", " + namespace
+                            + ", (void*)(param->" + attribs[i].getParamNameWithoutSymbols() + "), "
                             + CUtils.getXSDTypeForBasicType(baseTypeName) + ");\n");
                 }
-                else
-                {
-                    /**
-                     * Dushshantha: If the simple type is a choice it is handled
-                     * as a pointer variable. These variables should be defined
-                     * as pointers in the header file. Chinthana: This is the
-                     * same in 'all' element
-                     */
-                    if (attribs[i].getChoiceElement()
+                else if (attribs[i].getChoiceElement()
                             || attribs[i].getAllElement()
                             || isElementNillable(i) || isElementOptional(i))
-                    {
-                        
-                        if (((attribs[i].getChoiceElement())&&(isElementNillable(i)))&& !(attribs[i].getTypeName().equals("xsd__string")) )
-                        {
-                            writer.write("\t\tpSZ->serializeAsElement(\""
-                                    + attribs[i].getSOAPElementNameAsString()
-                                    + "\", "
-                                    + namespace
-                                    + ", (void*)(*(param->"
-                                    + attribs[i].getParamNameWithoutSymbols()
-                                    + ")), "
-                                    + CUtils.getXSDTypeForBasicType(baseTypeName) + ");\n");
-                        }
-                        else
-                        {
-                            writer.write("\t\tpSZ->serializeAsElement(\""
-                                    + attribs[i].getSOAPElementNameAsString()
-                                    + "\", "
-                                    + namespace
-                                    + ", (void*)(param->"
-                                    + attribs[i].getParamNameWithoutSymbols()
-                                    + "), "
-                                    + CUtils.getXSDTypeForBasicType(baseTypeName) + ");\n");
-                        }    
-                    }                           
-                    else
-                    {
-                        writer.write("\tpSZ->serializeAsElement(\""
-                                + attribs[i].getSOAPElementNameAsString()
-                                + "\", "
-                                + namespace
-                                + ", (void*)&(param->"
-                                + attribs[i].getParamNameWithoutSymbols()
-                                + "), "
-                                + CUtils.getXSDTypeForBasicType(baseTypeName) + ");\n");
+                {
+                    // If the simple type is a choice it is handled
+                    // as a pointer variable. These variables should be defined
+                    // as pointers in the header file. This is the same in 'all' element
+                    
+                    if (((attribs[i].getChoiceElement())
+                            && (isElementNillable(i)))
+                            && !(attribs[i].getTypeName().equals("xsd__string")) )
+                    {
+                        writer.write("\t\tpSZ->serializeAsElement(\""
+                                + attribs[i].getSOAPElementNameAsString() + "\", " + namespace
+                                + ", (void*)(*(param->" + attribs[i].getParamNameWithoutSymbols()
+                                + ")), " + CUtils.getXSDTypeForBasicType(baseTypeName) + ");\n");
                     }
+                    else
+                    {
+                        writer.write("\t\tpSZ->serializeAsElement(\""
+                                + attribs[i].getSOAPElementNameAsString() + "\", " + namespace
+                                + ", (void*)(param->" + attribs[i].getParamNameWithoutSymbols()
+                                + "), " + CUtils.getXSDTypeForBasicType(baseTypeName) + ");\n");
+                    }    
+                }                           
+                else
+                {
+                    writer.write("\tpSZ->serializeAsElement(\""
+                            + attribs[i].getSOAPElementNameAsString() + "\", " + namespace
+                            + ", (void*)&(param->" + attribs[i].getParamNameWithoutSymbols()
+                            + "), " + CUtils.getXSDTypeForBasicType(baseTypeName) + ");\n");
                 }
                 
                 if (attribs[i].isOptional())
-                {
                     writer.write("\t\t}\n");
-                }
             }
             else
             {
                 //if complex type
                 String elm = attribs[i].getParamName();
                 if (elm.lastIndexOf("_Ref") > -1)
-                {
                     elm = elm.substring(0, elm.lastIndexOf("_Ref"));
-                }
 
                 if (elm.charAt(0) == '_')
-                {
                     elm = elm.substring(1, elm.length());
-                }
                 
                 if (attribs[i].isReference())
-                {
                     elm = attribs[i].getTypeName();
-                }
                 
                 if (attribs[i].isOptional())
-                {
                     writer.write("\tif (param->" + attribs[i].getParamName() + " != NULL)\n\t{\n");
-                }
                 
                 if (attribs[i].getNsQualified())
                 {
@@ -860,35 +730,23 @@
                 }
                 
                 if (attribs[i].isOptional())
-                {
                     writer.write("\t}\n");
-                }
-
             }
-            //Dushshantha:
+
             //end if choice element
 
             if (attribs[i].getChoiceElement())
-            {
                 writer.write("\t}\n");
-            }
             
-            //Chinthana: end if
             if (attribs[i].getAllElement())
-            {
                 if (attribs[i].getMinOccurs() == 0)
-                {
                     writer.write("\t}\n");
-                }
-            }
         }
 
         writer.write("\n\tif (!bArray && blnIsNewPrefix)\n");
         writer.write("\t{\n");
-        writer.write("\t\tpSZ->removeNamespacePrefix(Axis_URI_"
-                        + classname + ");\n");
+        writer.write("\t\tpSZ->removeNamespacePrefix(Axis_URI_" + classname + ");\n");
         writer.write("\t}\n\n");
-
         
         writer.write("\treturn AXIS_SUCCESS;\n");
         writer.write("}\n\n");
@@ -898,8 +756,7 @@
     {
         int arrayCount = 0;
         writer.write("/*\n");
-        writer.write(" * This static method deserialize a " + classname
-                + " type of object\n");
+        writer.write(" * This static method deserialize a " + classname + " type of object\n");
         writer.write(" */\n");
         writer.write("int Axis_DeSerialize_" + classname + "(" + classname
                 + "* param, IWrapperSoapDeSerializer* pIWSDZ)\n{\n");
@@ -909,8 +766,7 @@
             if (extensionBaseAttrib != null)
             {
                 writer.write("\tpIWSDZ->getChardataAs((void*)&(param->"
-                        + extensionBaseAttrib.getParamNameAsMember()
-                        + "), "
+                        + extensionBaseAttrib.getParamNameAsMember() + "), "
                         + CUtils.getXSDTypeForBasicType(extensionBaseAttrib.getTypeName()) + ");\n");
             }
             else
@@ -918,10 +774,12 @@
                 System.out.println("Possible error in class " + classname
                         + ": class with no attributes....................");
             }
+            
             writer.write("\treturn AXIS_SUCCESS;\n");
             writer.write("}\n\n");
             return;
         }
+        
         String arrayType = null;
         boolean peekCalled = false;
         boolean firstIfWritten = false;
@@ -930,7 +788,6 @@
         
         for (int i = 0; i < attribs.length; i++)
         {
-            //Dushshantha:
             //if the attribute is a 'choice' construct we have to peek and make
             // the choice
 
@@ -948,20 +805,15 @@
                     firstIfWritten = true;
                 } 
                 else
-                {
                     writer.write("\telse if");
-                }
 
                 writer.write("(strcmp(choiceName,\""
-                        + attribs[i].getElementNameAsString()
-                        + "\")==0)\n\t{\n\t");
+                        + attribs[i].getElementNameAsString() + "\")==0)\n\t{\n\t");
             }
 
-            //Chinthana:
             //if the attribute is a 'all' construct we have to check Min
             // occures
             if (attribs[i].getAllElement())
-            {
                 if (attribs[i].getMinOccurs() == 0)
                 {
                     if (!foundAll)
@@ -976,11 +828,9 @@
                     writer.write("\t\tpeekCalled = true;\n");
                     writer.write("\t}\n");
                     writer.write("\tif(strcmp(allName,\""
-                            + attribs[i].getParamNameAsMember()
-                            + "\")==0)\n\t{\n\t");
+                            + attribs[i].getParamNameAsMember() + "\")==0)\n\t{\n\t");
                     writer.write("\tpeekCalled = false;\n\t");
                 }
-            }
             
             if (attribs[i].isAnyType())
             {
@@ -995,13 +845,10 @@
                 {
                     String baseTypeName = null;
                     if (!attribs[i].isSimpleType() && attribs[i].getType().isSimpleType())
-                    {
                         baseTypeName = CUtils.getclass4qname(attribs[i].getType().getBaseType());
-                    }
                     else
-                    {
-                        baseTypeName = attribs[i].getTypeName();;
-                    }
+                        baseTypeName = attribs[i].getTypeName();
+
                     writer.write("\tAxis_Array * array" + arrayCount + " = pIWSDZ->getBasicArray("
                             + CUtils.getXSDTypeForBasicType(baseTypeName) + ", \""
                             + attribs[i].getParamNameAsSOAPElement()
@@ -1017,17 +864,10 @@
                 {
                     arrayType = attribs[i].getTypeName();
                     writer.write("\tpIWSDZ->getCmplxArray(param->" + attribs[i].getParamNameAsMember() + ", (void*)Axis_DeSerialize_"
-                                    + arrayType
-                                    + ",\n"
-                                    + "\t\t\t\t\t\t\t\t  (void*)Axis_Create_"
-                                    + arrayType
-                                    + ",\n"
-                                    + "\t\t\t\t\t\t\t\t  (void*)Axis_Delete_"
-                                    + arrayType
-                                    + ",\n"
-                                    + "\t\t\t\t\t\t\t\t  (void*)Axis_GetSize_"
-                                    + arrayType
-                                    + ",\n"
+                                    + arrayType + ",\n"
+                                    + "\t\t\t\t\t\t\t\t  (void*)Axis_Create_" + arrayType + ",\n"
+                                    + "\t\t\t\t\t\t\t\t  (void*)Axis_Delete_" + arrayType + ",\n"
+                                    + "\t\t\t\t\t\t\t\t  (void*)Axis_GetSize_" + arrayType + ",\n"
                                     + "\t\t\t\t\t\t\t\t  \""
                                     + attribs[i].getElementNameAsString()
                                     + "\", Axis_URI_" + arrayType + ");\n\n");
@@ -1037,21 +877,13 @@
             else if ((attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
             {
                 //TODO handle optional attributes
-                //Samisa
                 //remove _Ref sufix and _ prefix in SOAP tag name
                 String soapTagName = (attribs[i].isAttribute() ? attribs[i].getParamName() : attribs[i].getElementNameAsString());
-                
                 if (soapTagName.lastIndexOf("_Ref") > -1)
-                {
                     soapTagName = soapTagName.substring(0, soapTagName.lastIndexOf("_Ref"));
-                }
 
                 if (soapTagName.charAt(0) == '_')
-                {
                     soapTagName = soapTagName.substring(1, soapTagName.length());
-                }
-                
-                //end remove _Ref sufix and _ prefix in SOAP tag name
                 
                 if (attribs[i].isOptional())
                 {
@@ -1063,13 +895,10 @@
                 Type type = attribs[i].getType();
                 boolean isPointerType = false;
                 if (type.isSimpleType())
-                {
                     isPointerType = CUtils.isPointerType(CUtils.getclass4qname(type.getBaseType())); 
-                }
                 else
-                {
                     isPointerType = CUtils.isPointerType(attribs[i].getTypeName());
-                }
+
                 if (attribs[i].isNillable() ||
                         isElementNillable(i) ||
                         isElementOptional(i) ||
@@ -1079,17 +908,12 @@
                     {
                         writer.write("\tparam->"
                                 + attribs[i].getParamNameAsMember()
-                                + " = ("
-                                + attribs[i].getTypeName()
-                                + "**)("
-                                + attribs[i].getTypeName()
-                                +"*)new "
-                                +attribs[i].getTypeName()
-                                + ";\n");
+                                + " = (" + attribs[i].getTypeName()
+                                + "**)(" + attribs[i].getTypeName()
+                                +"*)new " +attribs[i].getTypeName() + ";\n");
                         
                         writer.write("\t\t*(param->"
-                                + attribs[i].getParamNameAsMember()
-                                + ") = pIWSDZ->"
+                                + attribs[i].getParamNameAsMember() + ") = pIWSDZ->"
                                 + CUtils.getParameterGetValueMethodName(
                                         attribs[i].getTypeName(), attribs[i].isAttribute()) + "( \""
                                 + soapTagName + "\",0);\n");
@@ -1099,17 +923,12 @@
                         String typeName = attribs[i].getTypeName();
                         String baseTypeName = null;
                         if (type.isSimpleType())
-                        {
-                            baseTypeName = CUtils.getclass4qname (type.getBaseType ());;
-                        }
+                            baseTypeName = CUtils.getclass4qname (type.getBaseType ());
                         else
-                        {
                             baseTypeName = typeName;
-                        }
+
                         String elementName = attribs[i].getParamNameAsMember();
                         
-                        
-                        
                         if( isPointerType)
                         {
                             writer.write("\t" + typeName + "    pValue" + i + " = pIWSDZ->" +
@@ -1130,66 +949,45 @@
                         writer.write( "\t\t\telse\n");
                         writer.write( "\t\t\t{\n");
                         
-                            String localElemName = elementName;
-                            if( elementName.endsWith( "_"))
-                            {
-                                localElemName = elementName.substring( 0, elementName.length() - 1);
-                                                                
-                            }
-                            
-                            writer.write("\t\t\t\tparam->set" + localElemName + " (pValue" + i + ");\n");
+                        String localElemName = elementName;
+                        if( elementName.endsWith( "_"))
+                            localElemName = elementName.substring( 0, elementName.length() - 1);
                         
-                        writer.write("\t\t\t\tAxis::AxisDelete( (void *) pValue" + i + ", " + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n\n");
-
+                        writer.write("\t\t\t\tparam->set" + localElemName + " (pValue" + i + ");\n");
+                        writer.write("\t\t\t\tAxis::AxisDelete( (void *) pValue" + i + ", " 
+                                + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n\n");
                         writer.write( "\t\t\t}\n");
                     }
                 } 
+                else if (attribs[i].getChoiceElement() || attribs[i].getAllElement())
+                {
+                    writer.write("\tparam->"
+                            + attribs[i].getParamNameAsMember() + " = pIWSDZ->"
+                            + CUtils.getParameterGetValueMethodName(
+                                    attribs[i].getTypeName(), attribs[i].isAttribute()) + "( \""
+                            + soapTagName + "\",0);\n");
+                }
                 else
                 {
-                    /**
-                     * Dushshantha: If the simple type is a choice it is handled
-                     * as a pointer variable. These variables should be defined
-                     * as pointers in the header file. 
-                     * Chinthana: This is the
-                     * same in 'all' element
-                     */
-                    if (attribs[i].getChoiceElement()
-                            || attribs[i].getAllElement())
-                    {
-                        writer.write("\tparam->"
-                                + attribs[i].getParamNameAsMember()
-                                + " = pIWSDZ->"
-                                + CUtils.getParameterGetValueMethodName(
-                                        attribs[i].getTypeName(), attribs[i].isAttribute()) + "( \""
-                                + soapTagName + "\",0);\n");
-                    }
-                    else
-                    {
-                        String elementNameToSearchFor = attribs[i].isAttribute()? attribs[i].getParamNameAsMember():attribs[i].getSOAPElementNameAsString();
-                        
-                        writer.write("\t" + attribs[i].getTypeName() + " * "
-                                + attribs[i].getParamNameAsMember()
-                                + " = NULL;\n\n");
-                        writer.write("\tif (("
-                                + attribs[i].getParamNameAsMember()
-                                + " = pIWSDZ->"
-                                + CUtils.getParameterGetValueMethodName(
-                                        attribs[i].getTypeName(), attribs[i].isAttribute()) + "( \""
-                                + elementNameToSearchFor + "\",0)) != NULL)\n\t{\n");
-                        
-                        String localElemName = attribs[i].getParamNameAsMember();
-                        if( localElemName.endsWith( "_"))
-                        {
-                            localElemName = localElemName.substring( 0, localElemName.length() - 1);
-                                                            
-                        }
-                        writer.write("\t\tparam->set"
-                                + localElemName + "(* "
-                                + attribs[i].getParamNameAsMember() + " );\n");
-                        writer.write("\t\tAxis::AxisDelete( (void *) " + attribs[i].getParamNameAsMember() + ", " + CUtils.getXSDTypeForBasicType( attribs[i].getTypeName()) + ");\n");
-                        writer.write("\t}\n");                        
-                    }
+                    String elementNameToSearchFor = attribs[i].isAttribute()? attribs[i].getParamNameAsMember():attribs[i].getSOAPElementNameAsString();
+                    
+                    writer.write("\t" + attribs[i].getTypeName() + " * "
+                            + attribs[i].getParamNameAsMember() + " = NULL;\n\n");
+                    writer.write("\tif ((" + attribs[i].getParamNameAsMember() + " = pIWSDZ->"
+                            + CUtils.getParameterGetValueMethodName(
+                                    attribs[i].getTypeName(), attribs[i].isAttribute()) + "( \""
+                            + elementNameToSearchFor + "\",0)) != NULL)\n\t{\n");
+                    
+                    String localElemName = attribs[i].getParamNameAsMember();
+                    if( localElemName.endsWith( "_"))
+                        localElemName = localElemName.substring( 0, localElemName.length() - 1);
+
+                    writer.write("\t\tparam->set"
+                            + localElemName + "(* " + attribs[i].getParamNameAsMember() + " );\n");
+                    writer.write("\t\tAxis::AxisDelete( (void *) " + attribs[i].getParamNameAsMember() + ", " + CUtils.getXSDTypeForBasicType( attribs[i].getTypeName()) + ");\n");
+                    writer.write("\t}\n");                        
                 }
+                
                 if (attribs[i].isOptional())
                 {
                     writer.write("\t\t\t}\n");
@@ -1202,19 +1000,14 @@
             else
             {
                 //if complex type
-                //Samisa
                 //remove _Ref sufix and _ prefix in SOAP tag name
                 String soapTagName = attribs[i].getParamName();
 
                 if (soapTagName.lastIndexOf("_Ref") > -1)
-                {
                     soapTagName = soapTagName.substring(0, soapTagName.lastIndexOf("_Ref"));
-                }
 
                 if (soapTagName.charAt(0) == '_')
-                {
                     soapTagName = soapTagName.substring(1, soapTagName.length());
-                }
                 
                 if (attribs[i].isOptional())
                 {
@@ -1223,7 +1016,6 @@
                     writer.write("\t{\n");
                 }
 
-                //end remove _Ref sufix and _ prefix in SOAP tag name
                 writer.write("\tparam->" + attribs[i].getParamNameAsMember()
                         + " = (" + attribs[i].getTypeName()
                         + "*)pIWSDZ->getCmplxObject((void*)Axis_DeSerialize_"
@@ -1243,30 +1035,19 @@
                 }
             }
 
-            //Dushshantha:
-            //end if
-
             if (attribs[i].getChoiceElement())
-            {
                 writer.write("\t}\n");
-            }
             
-            //Chinthana: end if
             if (attribs[i].getAllElement())
-            {
                 if (attribs[i].getMinOccurs() == 0)
-                {
                     writer.write("\t}\n");
-                }
-            }
         }
 
         if (extensionBaseAttrib != null
                 && extensionBaseAttrib.getTypeName() != null)
         {
             writer.write("\tpIWSDZ->getChardataAs((void*)&(param->"
-                    + extensionBaseAttrib.getParamNameAsMember()
-                    + "), "
+                    + extensionBaseAttrib.getParamNameAsMember() + "), "
                     + CUtils.getXSDTypeForBasicType(extensionBaseAttrib.getTypeName()) + ");\n");
         }
 
@@ -1279,8 +1060,7 @@
         writer.write("void* Axis_Create_" + classname + "(" + classname
                 + "* pObj, bool bArray = false, int nSize=0)\n{\n");
         writer.write("\tif (bArray && (nSize > 0))\n\t{\n\t\tif (pObj)\n\t\t{\n");
-        writer.write("\t\t\t" + classname + "* pNew = new " + classname
-                + "[nSize];\n");
+        writer.write("\t\t\t" + classname + "* pNew = new " + classname + "[nSize];\n");
 
         writer.write("\t\t\tsize_t i = nSize/2;\n");
         writer.write("\t\t\tfor (int ii = 0; ii < (int) i; ++ii)\n"); 
@@ -1291,16 +1071,14 @@
 
         writer.write("\t\t\tdelete [] pObj;\n");
         writer.write("\t\t\treturn pNew;\n\t\t}\n\t\telse\n\t\t{\n");
-        writer.write("\t\t\treturn new " + classname
-                        + "[nSize];\n\t\t}\n\t}\n");
+        writer.write("\t\t\treturn new " + classname + "[nSize];\n\t\t}\n\t}\n");
         writer.write("\telse\n\t\treturn new " + classname + ";\n}\n\n");
     }
 
     private void writeDeleteGlobalMethod() throws IOException
     {
         writer.write("/*\n");
-        writer.write(" * This static method delete a " + classname
-                + " type of object\n");
+        writer.write(" * This static method delete a " + classname + " type of object\n");
         writer.write(" */\n");
         writer.write("void Axis_Delete_" + classname + "(" + classname
                 + "* param, bool bArray = false, int nSize=0)\n");
@@ -1349,11 +1127,13 @@
                         writer.write("\t\t// This object is a 'choice' or 'all', so need to ensure that any\n");
                         writer.write("\t\t// other objects belonging to this union of elements are empty.\n");
                         writer.write("\t\t// NB: Hasn't been implemented yet!\n");
-                        writer.write("\t" + attribs[i].getParamNameAsMember() + " = new " + attribs[i].getTypeName() +"_Array();\n");
+                        writer.write("\t" + attribs[i].getParamNameAsMember() + " = new " 
+                                + attribs[i].getTypeName() +"_Array();\n");
                     }
                     else
                     {
-                        writer.write("\t" + attribs[i].getParamNameAsMember() + " = new " + attribs[i].getTypeName() +"_Array();\n");
+                        writer.write("\t" + attribs[i].getParamNameAsMember() + " = new " 
+                                + attribs[i].getTypeName() +"_Array();\n");
                     }
                 }
             }
@@ -1373,11 +1153,15 @@
                         writer.write("\t\t// This object is a 'choice' or 'all', so need to ensure that any\n");
                         writer.write("\t\t// other objects belonging to this union of elements are empty.\n");
                         writer.write("\t\t// NB: Hasn't been implemented yet!\n");
-                        writer.write("\t" + attribs[i].getParamName() + " = new " + attribs[i].getTypeName() + "_Array( *original." + attribs[i].getParamName() + ");\n");
+                        writer.write("\t" + attribs[i].getParamName() + " = new " 
+                                + attribs[i].getTypeName() + "_Array( *original." 
+                                + attribs[i].getParamName() + ");\n");
                     }
                     else
                     {
-                        writer.write("\t" + attribs[i].getParamName() + " = new " + attribs[i].getTypeName() + "_Array(*original." + attribs[i].getParamName() + ");\n");
+                        writer.write("\t" + attribs[i].getParamName() + " = new " 
+                                + attribs[i].getTypeName() + "_Array(*original." 
+                                + attribs[i].getParamName() + ");\n");
                     }
                 }
                 else if (attribs[i].isAnyType())
@@ -1397,13 +1181,10 @@
                     Type type = attribs[i].getType();
                     boolean isPointerType = false;
                     if (type.isSimpleType())
-                    {
                         isPointerType = CUtils.isPointerType(CUtils.getclass4qname(type.getBaseType())); 
-                    }
                     else
-                    {
                         isPointerType = CUtils.isPointerType(attribs[i].getTypeName());
-                    }
+
                     if ((attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()) && (isPointerType || attribs[i].isOptional() || attribs[i].isNillable() || attribs[i].getChoiceElement() || attribs[i].getAllElement()))
                     {
                         writer.write("\t" + attribs[i].getParamName() + " = NULL;\n");
@@ -1414,29 +1195,27 @@
                             String localMethodName = methodName.substring( 0, methodName.length() - 1);
                             
                             if( localMethodName.equals( classname))
-                            {
                                 methodName = localMethodName; 
-                            }
                         }
                         writer.write("\tset" + methodName + "(original." + attribs[i].getParamName() + ", original.__axis_deepcopy_" + attribs[i].getParamName() + ");\n\n");
                     }
+                    else if (attribs[i].isSimpleType())
+                    {
+                        writer.write("\t" + attribs[i].getParamName() + " = original." 
+                                + attribs[i].getParamName() + ";\n");
+                    }
                     else
                     {
-                        if (attribs[i].isSimpleType())
-                        {
-                            writer.write("\t" + attribs[i].getParamName() + " = original." + attribs[i].getParamName() + ";\n");
-                        }
-                        else
-                        {
-                            writer.write("\tif (original." + attribs[i].getParamName() + " != NULL)\n");
-                            writer.write("\t{\n");
-                            writer.write("\t\t" + attribs[i].getParamName() + " = new " + attribs[i].getTypeName() + "(*(original." + attribs[i].getParamName() + "));\n");
-                            writer.write("\t}\n");
-                            writer.write("\telse\n");
-                            writer.write("\t{\n");
-                            writer.write("\t\t" + attribs[i].getParamName() + " = NULL;\n");
-                            writer.write("\t}\n");
-                        }
+                        writer.write("\tif (original." + attribs[i].getParamName() + " != NULL)\n");
+                        writer.write("\t{\n");
+                        writer.write("\t\t" + attribs[i].getParamName() + " = new " 
+                                + attribs[i].getTypeName() + "(*(original." 
+                                + attribs[i].getParamName() + "));\n");
+                        writer.write("\t}\n");
+                        writer.write("\telse\n");
+                        writer.write("\t{\n");
+                        writer.write("\t\t" + attribs[i].getParamName() + " = NULL;\n");
+                        writer.write("\t}\n");
                     }
                 }
             }
@@ -1476,9 +1255,7 @@
                         writer.write("\t" + attribs[i].getParamNameAsMember() + "->clear();\n");
                     }
                     else
-                    {
                         writer.write("\t" + attribs[i].getParamNameAsMember() + "->clear();\n");
-                    }
                 }
                 else if (!(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
                 {
@@ -1489,15 +1266,11 @@
                                 + "= NULL;\n");
                     }
                     else
-                    {
-                        writer.write("\t" + attribs[i].getParamNameAsMember()
-                                + "= NULL;\n");
-                    }
+                        writer.write("\t" + attribs[i].getParamNameAsMember() + "= NULL;\n");
                 }
                 else if (isElementNillable(i) || isElementOptional(i) || attribs[i].getChoiceElement() || attribs[i].getAllElement())
                 {
-                    writer.write("\t" + attribs[i].getParamNameAsMember()
-                            + " = NULL;\n");
+                    writer.write("\t" + attribs[i].getParamNameAsMember() + " = NULL;\n");
                     writer.write("\t__axis_deepcopy_" + attribs[i].getParamName() + " = false;\n");
                 }
                 else
@@ -1505,13 +1278,10 @@
                     Type type = attribs[i].getType();
                     boolean isPointerType = false;
                     if (type.isSimpleType())
-                    {
                         isPointerType = CUtils.isPointerType(CUtils.getclass4qname(type.getBaseType())); 
-                    }
                     else
-                    {
                         isPointerType = CUtils.isPointerType(attribs[i].getTypeName());
-                    }
+
                     if(isPointerType)
                     {
                         writer.write("\t"+ attribs[i].getParamNameAsMember() + " = NULL;\n");
@@ -1538,13 +1308,9 @@
         try
         {
             if (type.isFault())
-            {
                 writer.write("\n" + classname + "::~" + classname + "() throw ()\n{\n");
-            }
             else
-            {
                 writer.write("\n" + classname + "::~" + classname + "()\n{\n");
-            }
             
             writer.write("\t/*delete any pointer and array members here*/\n");
             int anyCounter = 0;
@@ -1557,13 +1323,9 @@
                 Type type = attribs[i].getType();
                 boolean isPointerType = false;
                 if (type.isSimpleType())
-                {
                     isPointerType = CUtils.isPointerType(CUtils.getclass4qname(type.getBaseType())); 
-                }
                 else
-                {
                     isPointerType = CUtils.isPointerType(typename);
-                }
                 
                 if(attribs[i].isArray())
                 {
@@ -1602,9 +1364,7 @@
                     writer.write("\t\t{\n");
                     writer.write("\t\t\tdelete ");
                     if (isPointerType)
-                    {
                         writer.write("[] ");
-                    }
                     writer.write(name + ";\n");
                     writer.write("\t\t}\n");
                     writer.write("\t\t" + name + " = NULL;\n");
@@ -1623,8 +1383,7 @@
     {
         try
         {
-            writer.write("int Check_Restrictions_" + classname + "("
-                    + classname + " value)\n");
+            writer.write("int Check_Restrictions_" + classname + "(" + classname + " value)\n");
             
             //TODO write code to check the restrictions.  FJP - Begun, but untested.
             
@@ -1642,18 +1401,12 @@
                 while( i.hasNext())
                 {
                     if( iIndex == 0)
-                    {
                         writer.write( "//\tif( ");
-                    }
                     else
-                    {
                         writer.write( " ||\n//\t    ");
-                    }
                     
                     QName qnElement = (QName) i.next();
-                    
                     writer.write( "!strcmp( value, " + classname+ "_" + qnElement.getNamespaceURI() + ")");
-                    
                     iIndex++;
                 }
                 
@@ -1673,18 +1426,13 @@
                 while( i.hasNext())
                 {
                     if( iIndex == 0)
-                    {
                         writer.write( "//\tif( ");
-                    }
                     else
-                    {
                         writer.write( " ||\n//\t    ");
-                    }
                     
                     QName qnElement = (QName) i.next();
-                    
-                    writer.write( "value == ENUM" + classname.toUpperCase()+ "_" + qnElement.getNamespaceURI());
-                    
+                    writer.write( "value == ENUM" + classname.toUpperCase()+ "_" 
+                            + qnElement.getNamespaceURI());
                     iIndex++;
                 }
                 
@@ -1725,9 +1473,7 @@
                     String key = (String) itForElemName.next();
 
                     if (aType.getElementForElementName(key).getNillable())
-                    {
                         nillable = true;
-                    }
                 }
             }
         }
@@ -1761,9 +1507,7 @@
                             String name = (String) itForElementType.next();
 
                             if ("count".equals(name))
-                            {
                                 moreThanOne = true;
-                            }
                         }
                     }
                 }



Mime
View raw message