You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2007/12/01 15:43:54 UTC

svn commit: r600141 [2/10] - in /webservices/axis2/branches/java/jaxws21/modules: adb-codegen/ adb-codegen/src/org/apache/axis2/schema/ adb-codegen/src/org/apache/axis2/schema/template/ adb-codegen/src/org/apache/axis2/schema/util/ adb-codegen/src/org/...

Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl Sat Dec  1 06:43:28 2007
@@ -5,20 +5,16 @@
     <xsl:template match="/beans">
         <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
         <xsl:variable name="axis2_name">adb_<xsl:value-of select="@name"/></xsl:variable>
-       /**
-        * <xsl:value-of select="$axis2_name"/>.c
-        *
-        * This file was auto-generated from WSDL
-        * by the Apache Axis2/Java version: #axisVersion# #today#
-        */
-
-       /**
-        *  <xsl:value-of select="$axis2_name"/>
-        */
+        /**
+         * <xsl:value-of select="$axis2_name"/>.c
+         *
+         * This file was auto-generated from WSDL
+         * by the Apache Axis2/Java version: #axisVersion# #today#
+         */
+         
         #include "<xsl:value-of select="$axis2_name"/>.h"
 
         <xsl:apply-templates/>
-
     </xsl:template>
     <!--cater for the multiple classes - unwrappped mode -->
     <xsl:template match="/">
@@ -34,36 +30,38 @@
         <xsl:variable name="nsuri"><xsl:value-of select="@nsuri"/></xsl:variable>
         <xsl:variable name="nsprefix"><xsl:value-of select="@nsprefix"/></xsl:variable>
         <xsl:variable name="anon"><xsl:value-of select="@anon"/></xsl:variable>
-        <xsl:variable name="ordered"><xsl:value-of select="@anon"/></xsl:variable>
-       /**
-        * <xsl:value-of select="$axis2_name"/>.h
-        *
-        * This file was auto-generated from WSDL
-        * by the Apache Axis2/C version: #axisVersion# #today#
-        *
-        */
+        <xsl:variable name="ordered"><xsl:value-of select="@ordered"/></xsl:variable>
+        <xsl:variable name="particleClass"><xsl:value-of select="@particleClass"/></xsl:variable> <!-- particle classes are used to represent schema groups -->
+        <xsl:variable name="hasParticleType"><xsl:value-of select="@hasParticleType"/></xsl:variable> <!-- particle classes are used to represent schema groups -->
+       
+        /**
+         * <xsl:value-of select="$axis2_name"/>.c
+         *
+         * This file was auto-generated from WSDL
+         * by the Apache Axis2/C version: #axisVersion# #today#
+         */
 
         #include "<xsl:value-of select="$axis2_name"/>.h"
-          <xsl:choose>
-             <xsl:when test="@type">
-              /**
-               * This type was generated from the piece of schema that had
-               * name = <xsl:value-of select="$originalName"/>
-               * Namespace URI = <xsl:value-of select="$nsuri"/>
-               * Namespace Prefix = <xsl:value-of select="$nsprefix"/>
-               */
-             </xsl:when>
-             <xsl:otherwise>
-              /**
-               * implmentation of the <xsl:value-of select="$originalName"/><xsl:if test="$nsuri">|<xsl:value-of select="$nsuri"/></xsl:if> element
-               */
-             </xsl:otherwise>
-          </xsl:choose>
+        <xsl:choose>
+            <xsl:when test="$istype">
+                /*
+                 * This type was generated from the piece of schema that had
+                 * name = <xsl:value-of select="$originalName"/>
+                 * Namespace URI = <xsl:value-of select="$nsuri"/>
+                 * Namespace Prefix = <xsl:value-of select="$nsprefix"/>
+                 */
+           </xsl:when>
+           <xsl:otherwise>
+               /*
+                * implmentation of the <xsl:value-of select="$originalName"/><xsl:if test="$nsuri">|<xsl:value-of select="$nsuri"/></xsl:if> element
+                */
+           </xsl:otherwise>
+        </xsl:choose>
 
 
         struct <xsl:value-of select="$axis2_name"/>
         {
-            <xsl:if test="not(@type)">
+            <xsl:if test="not($istype)">
                 axutil_qname_t* qname;
             </xsl:if>
 
@@ -72,9 +70,7 @@
                    <xsl:choose>
                      <xsl:when test="@isarray">axutil_array_list_t*</xsl:when>
                      <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
-                     <xsl:when test="@ours">
-                            adb_<xsl:value-of select="@type"/>_t*
-                    </xsl:when>
+                     <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
                      <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
                    </xsl:choose>
                 </xsl:variable>
@@ -82,18 +78,72 @@
                 <xsl:variable name="CName"><xsl:value-of select="@cname"></xsl:value-of></xsl:variable>
 
                 <xsl:value-of select="$propertyType"/><xsl:text> </xsl:text>property_<xsl:value-of select="$CName"/>;
+
+                <!-- For arrays is_valid_* tracks for whether at least one element of the array is non-NULL -->
+                <xsl:text>axis2_bool_t is_valid_</xsl:text><xsl:value-of select="$CName"/>;
+
             </xsl:for-each>
         };
 
 
+       /************************* Private Function prototypes ********************************/
+        <xsl:for-each select="property">
+            <xsl:variable name="propertyType">
+            <xsl:choose>
+                <xsl:when test="@isarray">axutil_array_list_t*</xsl:when>
+                <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+                <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+                <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+            </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="propertyName"><xsl:value-of select="@name"></xsl:value-of></xsl:variable>
+            <xsl:variable name="CName"><xsl:value-of select="@cname"></xsl:value-of></xsl:variable>
+
+            <xsl:variable name="nativePropertyType"> <!--these are used in arrays to take the native type-->
+               <xsl:choose>
+                 <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+                 <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+                 <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+               </xsl:choose>
+            </xsl:variable>
+              <xsl:variable name="PropertyTypeArrayParam"> <!--these are used in arrays to take the type stored in the arraylist-->
+                 <xsl:choose>
+                   <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
+                   <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
+                   <xsl:when test="@type='short' or @type='char' or @type='int' or @type='float' or @type='double' or @type='long'"><xsl:value-of select="@type"/><xsl:text>*</xsl:text></xsl:when>
+                   <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
+                 </xsl:choose>
+              </xsl:variable>
+            <xsl:variable name="paramComment">
+                <xsl:choose>
+                    <xsl:when test="@isarray"><xsl:text>Array of </xsl:text><xsl:value-of select="$PropertyTypeArrayParam"/><xsl:text>s.</xsl:text></xsl:when>
+                    <xsl:otherwise><xsl:value-of select="$nativePropertyType"/></xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+
+            <xsl:if test="not(@nillable or @optional)">
+                axis2_status_t AXIS2_CALL
+                <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_nil_at(
+                        <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>, 
+                        const axutil_env_t *env, int i);
+
+                axis2_status_t AXIS2_CALL
+                <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>_nil(
+                        <xsl:value-of select="$axis2_name"/>_t*<xsl:text> _</xsl:text><xsl:value-of select="$name"/>,
+                        const axutil_env_t *env);
+            </xsl:if>
+
+          </xsl:for-each>
+
+
        /************************* Function Implmentations ********************************/
         AXIS2_EXTERN <xsl:value-of select="$axis2_name"/>_t* AXIS2_CALL
         <xsl:value-of select="$axis2_name"/>_create(
             const axutil_env_t *env)
         {
             <xsl:value-of select="$axis2_name"/>_t *<xsl:value-of select="$name"/> = NULL;
-            <xsl:if test="not(@type)">
-              axutil_qname_t* qname = NULL;
+            <xsl:if test="not($istype)">
+                axutil_qname_t* qname = NULL;
             </xsl:if>
             AXIS2_ENV_CHECK(env, NULL);
 
@@ -111,20 +161,21 @@
             <xsl:for-each select="property">
                 <xsl:variable name="CName"><xsl:value-of select="@cname"></xsl:value-of></xsl:variable>
                 <xsl:choose>
-                  <xsl:when test="@ours">
+                  <xsl:when test="@ours or @type='axis2_char_t*' or @type='axutil_qname_t*' or @type='axutil_duration_t*' or @type='axutil_uri_t*' or @type='axutil_date_time_t*' or @type='axutil_base64_binary_t*'">
                     <xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/>  = NULL;
                   </xsl:when>
                   <!-- todo for others -->
                 </xsl:choose>
+                <xsl:value-of select="$name"/>->is_valid_<xsl:value-of select="$CName"/>  = AXIS2_FALSE;
             </xsl:for-each>
 
-            <xsl:if test="not(@type)">
+            <xsl:if test="not($istype)">
               <xsl:choose>
                 <xsl:when test="$nsuri and $nsuri != ''">
                   qname =  axutil_qname_create (env,
                         "<xsl:value-of select="$originalName"/>",
                         "<xsl:value-of select="$nsuri"/>",
-                        "<xsl:value-of select="$nsprefix"/>");
+                        NULL);
                 </xsl:when>
                 <xsl:otherwise>
                   qname =  axutil_qname_create (env,
@@ -146,130 +197,17 @@
                 const axutil_env_t *env)
         {
             <xsl:if test="property/@isarray">
-                  int i = 0;
-                  int count = 0;
-                  void *element = NULL;
+                int i = 0;
+                int count = 0;
+                void *element = NULL;
             </xsl:if>
 
             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+            AXIS2_PARAM_CHECK(env->error, <xsl:value-of select="$name"/>, AXIS2_FAILURE);
 
             <xsl:for-each select="property">
-             <!-- please check all the freeing thing below -->
-             <xsl:if test="@isarray or @ours or @type='axis2_char_t*' or @type='axutil_qname_t*' or @type='axutil_duration_t*' or @type='axutil_uri_t*' or @type='axutil_date_time_t*' or @type='axutil_base64_binary_t*'">
-              <xsl:variable name="propertyType">
-                 <xsl:choose>
-                   <xsl:when test="@isarray">axutil_array_list_t*</xsl:when>
-                   <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
-                   <xsl:when test="@ours">
-                    adb_<xsl:value-of select="@type"/>_t*
-                    </xsl:when>
-                   <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
-                 </xsl:choose>
-              </xsl:variable>
-              <xsl:variable name="nativePropertyType"> <!--these are used in arrays to take the native type-->
-                 <xsl:choose>
-                   <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
-                   <xsl:when test="@ours">
-                    adb_<xsl:value-of select="@type"/>_t*
-                   </xsl:when>
-                   <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
-                 </xsl:choose>
-              </xsl:variable>
-              <xsl:variable name="propertyName"><xsl:value-of select="@name"></xsl:value-of></xsl:variable>
-              <xsl:variable name="CName"><xsl:value-of select="@cname"></xsl:value-of></xsl:variable>
-
-              <xsl:variable name="propertyInstanceName"><!--these are used in arrays to take the native type-->
-                 <xsl:choose>
-                   <xsl:when test="@isarray">(<xsl:value-of select="$nativePropertyType"/>)element</xsl:when>
-                   <xsl:otherwise><xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/></xsl:otherwise>
-                 </xsl:choose>
-              </xsl:variable>
-              <xsl:variable name="justPropertyInstanceName"><!--these are used in arrays to take the native type-->
-                 <xsl:choose>
-                   <xsl:when test="@isarray">element</xsl:when>
-                   <xsl:otherwise><xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/></xsl:otherwise>
-                 </xsl:choose>
-              </xsl:variable>
-
-
-
-              <!-- handles arrays -->
-              <xsl:if test="@isarray">
-                if (<xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/> != NULL)
-                {
-                    count = axutil_array_list_size(<xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/>, env);
-                    for(i = 0; i &lt; count; i ++)
-                    {
-                       element = axutil_array_list_get(<xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/>, env, i);
-              </xsl:if>
-
-              <!-- the following element can be inside array or independent one -->
-                 <!--xsl:if test="$nativePropertyType!='axis2_char_t*'"-->
-              if(<xsl:value-of select="$justPropertyInstanceName"/> != NULL)
-              {
-                 <!-- how to free all the ours things -->
-                 <xsl:choose>
-                   <xsl:when test="@ours">
-                      adb_<xsl:value-of select="@type"/>_free(<xsl:value-of select="$propertyInstanceName"/>, env);
-                   </xsl:when>
-
-                   <xsl:when test="$nativePropertyType='unsigned short' or $nativePropertyType='unsigned char' or $nativePropertyType='unsigned int' or $nativePropertyType='unsigned long' or $nativePropertyType='short' or $nativePropertyType='axis2_byte_t' or $nativePropertyType='axis2_bool_t' or $nativePropertyType='char' or $nativePropertyType='int' or $nativePropertyType='float' or $nativePropertyType='double' or $nativePropertyType='long'">
-                     <xsl:if test="@isarray">
-                      <!-- free ints, longs, float in array-->
-                      /** we keep primtives as pointers in arrasy, so need to free them */
-                      AXIS2_FREE(env-> allocator, element);
-                     </xsl:if>
-                   </xsl:when>
-
-                   <!-- free axis2_char_t s -->
-                   <xsl:when test="$nativePropertyType='axis2_char_t*' and not(@isarray)">
-                      AXIS2_FREE(env-> allocator, <xsl:value-of select="$propertyInstanceName"/>);
-                   </xsl:when>
-
-                   <!-- free nodes -->
-                   <xsl:when test="$nativePropertyType='axiom_node_t*'">
-                    axiom_node_free_tree (<xsl:value-of select="$propertyInstanceName"/>, env);
-                   </xsl:when>
-
-                   <xsl:when test="$nativePropertyType='axutil_qname_t*'">
-                    axutil_qname_free(<xsl:value-of select="$propertyInstanceName"/>, env);
-                   </xsl:when>
-
-                   <xsl:when test="$nativePropertyType='axutil_uri_t*'">
-                    axutil_uri_free(<xsl:value-of select="$propertyInstanceName"/>, env);
-                   </xsl:when>
-
-                   <xsl:when test="$nativePropertyType='axutil_duration_t*'">
-                    axutil_duration_free(<xsl:value-of select="$propertyInstanceName"/>, env);
-                   </xsl:when>
-
-                   <xsl:when test="$nativePropertyType='axutil_date_time_t*'">
-                    axutil_date_time_free(<xsl:value-of select="$propertyInstanceName"/>, env);
-                   </xsl:when>
-
-                   <xsl:when test="$propertyType='axutil_base64_binary_t*'">
-                    axutil_base64_binary_free (<xsl:value-of select="$propertyInstanceName"/>, env);
-                   </xsl:when>
-                     <xsl:when test="$propertyType='axutil_duration_t*'">
-                    axutil_duration_free (<xsl:value-of select="$propertyInstanceName"/>, env);
-                   </xsl:when>
-
-                   <!--TODO: This should be extended for all the types that should be freed.. -->
-                   <xsl:otherwise>
-                     /** This is an unknown type or a primitive. Please free this manually*/
-                   </xsl:otherwise>
-                 </xsl:choose>
-                 <xsl:value-of select="$justPropertyInstanceName"/> = NULL;
-              }
-
-              <!--/xsl:if-->
-              <!-- close tags arrays -->
-              <xsl:if test="@isarray">
-                    }
-                    axutil_array_list_free(<xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/>, env);
-                }
-              </xsl:if>
-             </xsl:if> <!--close for test of primitive types -->
+                <xsl:variable name="CName"><xsl:value-of select="@cname"></xsl:value-of></xsl:variable>
+                <xsl:value-of select="$axis2_name"/>_reset_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env);
             </xsl:for-each>
 
             <xsl:if test="not(@type)">
@@ -299,7 +237,7 @@
             {
               axis2_status_t status = AXIS2_SUCCESS;
             <xsl:if test="property/@type='axutil_date_time_t*' or property/@type='axutil_base64_binary_t*'">
-               void *element = NULL;
+              void *element = NULL;
             </xsl:if>
             <xsl:if test="property/@type='axutil_qname_t*'">
               axis2_char_t *cp = NULL;
@@ -311,18 +249,14 @@
                    <xsl:choose>
                      <xsl:when test="@isarray">axutil_array_list_t*</xsl:when>
                      <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
-                     <xsl:when test="@ours">
-                     adb_<xsl:value-of select="@type"/>_t*
-                     </xsl:when>
+                     <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
                      <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
                    </xsl:choose>
                 </xsl:variable>
                 <xsl:variable name="nativePropertyType"> <!--these are used in arrays to take the native type-->
                    <xsl:choose>
                      <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
-                     <xsl:when test="@ours">
-                      adb_<xsl:value-of select="@type"/>_t*
-                     </xsl:when>
+                     <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
                      <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
                    </xsl:choose>
                 </xsl:variable>
@@ -388,7 +322,7 @@
 
                     if(prefix_found)
                     {
-                        /* node value contain  the prefix */
+                        /* node value contain the prefix */
                         qname_ns = axiom_element_find_namespace_uri(axiom_node_get_data_element(parent, env), env, node_value, parent);
                     }
                     else
@@ -398,7 +332,7 @@
                         qname_ns = axiom_element_get_default_namespace(axiom_node_get_data_element(parent, env), env, parent);
                     }
 
-                    <!-- we are done extracting info, just set the extracted value to the qname -->
+                     <!-- we are done extracting info, just set the extracted value to the qname -->
 
                      <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
                                                     env,
@@ -456,12 +390,12 @@
                                                     env, (<xsl:value-of select="$nativePropertyType"/>)element);
                   </xsl:when>
                   <xsl:when test="@ours">
-                    <!-- It seems this is in an unreachable path -->
+                     <!-- It seems this is in an unreachable path -->
                   </xsl:when>
                   <xsl:otherwise>
-                    <!--TODO: add new attributes types -->
-                    /** can not handle the attribute type <xsl:value-of select="$nativePropertyType"/>*/
-                    status = AXIS2_FAILURE;
+                     <!--TODO: add new attributes types -->
+                     /* can not handle the attribute type <xsl:value-of select="$nativePropertyType"/>*/
+                     status = AXIS2_FAILURE;
                   </xsl:otherwise>
                 </xsl:choose>   
               </xsl:for-each>
@@ -473,20 +407,25 @@
         <xsl:value-of select="$axis2_name"/>_deserialize(
                 <xsl:value-of select="$axis2_name"/>_t*<xsl:text> </xsl:text><xsl:value-of select="$name"/>,
                 const axutil_env_t *env,
-                axiom_node_t* parent)
+                axiom_node_t **dp_parent)
         {
+          axiom_node_t *parent = *dp_parent;
+          
           axis2_status_t status = AXIS2_SUCCESS;
-          <xsl:if test="property/@attribute">
-               axiom_attribute_t *parent_attri = NULL;
-               axiom_element_t *parent_element = NULL;
-               axis2_char_t *attrib_text = NULL;
+          <xsl:if test="count(property[@attribute])!=0">
+              axiom_attribute_t *parent_attri = NULL;
+              axiom_element_t *parent_element = NULL;
+              axis2_char_t *attrib_text = NULL;
+
+              axutil_hash_t *attribute_hash = NULL;
+
           </xsl:if>
           <xsl:if test="property/@ours or (property/@isarray and (property/@type='unsigned short' or property/@type='unsigned char' or property/@type='unsigned int' or property/@type='unsigned long' or property/@type='short' or property/@type='int' or property/@type='char' or property/@type='long' or property/@type='float' or property/@type='axis2_byte_t' or property/@type='axis2_bool_t' or property/@type='double')) or property/@type='axutil_date_time_t*' or property/@type='axutil_base64_binary_t*'">
-               void *element = NULL;
+              void *element = NULL;
           </xsl:if>
-          <!-- these two are requried -->
 
-         <xsl:for-each select="property">
+          <!-- these two are requried -->
+          <xsl:for-each select="property">
             <xsl:if test="position()=1"> <!-- check for at least one element exists -->
              axis2_char_t* text_value = NULL;
              axutil_qname_t *qname = NULL;
@@ -522,11 +461,6 @@
             </xsl:when>
             <xsl:otherwise>
 
-            <xsl:for-each select="property">
-              <xsl:if test="position()=1"> <!-- check for at least one element exists -->
-                axiom_namespace_t *ns1 = NULL;
-              </xsl:if>
-            </xsl:for-each>
             <xsl:if test="property/@isarray">
                int i = 0;
                int element_found = 0;
@@ -536,14 +470,6 @@
                int sequence_broken = 0;
                axiom_node_t *tmp_node = NULL;
             </xsl:if>
-            <!--<xsl:if test="property">
-              <xsl:if test="not(property/@attribute) and  (not(property/@ours) or property/@ours='')">
-                axis2_char_t* text_value = NULL;
-              </xsl:if>
-            </xsl:if>
-            <xsl:if test="property and (not(@type) or @type='' or property/@attribute)">
-               axutil_qname_t *qname = NULL;
-            </xsl:if>-->
             <xsl:variable name="element_qname_var_requred">
                   <xsl:for-each select="property">
                     <xsl:if test="(not(@attribute) and @isarray) or not(../@ordered)">
@@ -558,42 +484,39 @@
             <xsl:for-each select="property">
              <xsl:if test="position()=1">
                axiom_node_t *first_node = NULL;
-               <!--<xsl:if test="not(../@type) or ../@type='' or property/@attribute">
-                 axutil_qname_t *qname = NULL;
-               </xsl:if>
-               axiom_node_t *current_node = NULL;
-               axiom_element_t *current_element = NULL;-->
              </xsl:if>
             </xsl:for-each>
             <xsl:if test="property and (not(property/@attribute) or property/@attribute='' or property/@notattribute)">
+               axis2_bool_t is_early_node_valid = AXIS2_TRUE;
                axiom_node_t *current_node = NULL;
                axiom_element_t *current_element = NULL;
             </xsl:if>
             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+            AXIS2_PARAM_CHECK(env->error, <xsl:value-of select="$name"/>, AXIS2_FAILURE);
 
-            <xsl:if test="$nsuri and $nsuri != ''">
-            <xsl:for-each select="property">
-              <xsl:if test="position()=1"> <!-- check for at least one element exists -->
-                ns1 = axiom_namespace_create (env,
-                                         "<xsl:value-of select="$nsuri"/>",
-                                         "<xsl:value-of select="$nsprefix"/>");
-              </xsl:if>
-            </xsl:for-each>
-            </xsl:if>
             <xsl:if test="property">
+              <!-- We are expected to have NULL elements in particle classes -->
+              <xsl:if test="not($particleClass)">
+              <!-- Wait until AXIOM_ELEMENT -->
+              while(parent &amp;&amp; axiom_node_get_node_type(parent, env) != AXIOM_ELEMENT)
+              {
+                  parent = axiom_node_get_next_sibling(parent, env);
+              }
               if (NULL == parent)
               {
-                /** This should be checked above */
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL elemenet for <xsl:value-of select="$originalName"/>"
-                                              " %d :: %s", env->error->error_number,
-                                              AXIS2_ERROR_GET_MESSAGE(env->error));
+                /* This should be checked before everything */
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                            "Failed in building adb object for <xsl:value-of select="$originalName"/> : "
+                            "NULL elemenet can not be passed to deserialize");
                 return AXIS2_FAILURE;
               }
+              </xsl:if>
             </xsl:if>
             <xsl:for-each select="property">
               <xsl:if test="position()=1"> <!-- check for at least one element exists -->
                  <xsl:choose>
                     <xsl:when test="not($istype)">
+
                     current_element = (axiom_element_t *)axiom_node_get_data_element(parent, env);
                     qname = axiom_element_get_qname(current_element, env, parent);
                     if (axutil_qname_equals(qname, env, <xsl:value-of select="$name"/>-> qname))
@@ -618,17 +541,22 @@
                         return AXIS2_FAILURE;
                     }
                     </xsl:when>
+                    <xsl:when test="$particleClass">
+                         first_node = parent;
+                    </xsl:when>
                     <xsl:otherwise>
                       <!-- for types, parent refers to the container element -->
                       first_node = axiom_node_get_first_child(parent, env);
+                      <!-- Let followers to check the situation
                       if(first_node == NULL)
                       {
                           AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                                             "Failed in building adb object for <xsl:value-of select="$originalName"/> : "
                                             "It is expected to have a child element");
-                          <!-- TODO: ADB specific error should be defined and set here -->
-                          return AXIS2_FAILURE;
-                      }
+                          TODO: ADB specific error should be defined and set here 
+                          return AXIS2_FAILURE; 
+                      } 
+                      -->
                     </xsl:otherwise>
                  </xsl:choose>
                </xsl:if>
@@ -639,9 +567,10 @@
 
           <!-- attributes are common to simple types(when used in simple content) and other types -->
             <xsl:for-each select="property/@attribute">
-             <xsl:if test="position()=1">
+              <xsl:if test="position()=1">
                  parent_element = (axiom_element_t *)axiom_node_get_data_element(parent, env);
-             </xsl:if>
+                 attribute_hash = axiom_element_get_all_attributes(parent_element, env);
+              </xsl:if>
             </xsl:for-each>
 
             <xsl:for-each select="property">
@@ -649,18 +578,14 @@
                  <xsl:choose>
                    <xsl:when test="@isarray">axutil_array_list_t*</xsl:when>
                    <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
-                   <xsl:when test="@ours">
-                    adb_<xsl:value-of select="@type"/>_t*
-                   </xsl:when>
+                   <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
                    <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
                  </xsl:choose>
               </xsl:variable>
               <xsl:variable name="nativePropertyType"> <!--these are used in arrays to take the native type-->
                  <xsl:choose>
                    <xsl:when test="not(@type)">axiom_node_t*</xsl:when> <!-- these are anonymous -->
-                   <xsl:when test="@ours">
-                    adb_<xsl:value-of select="@type"/>_t*
-                   </xsl:when>
+                   <xsl:when test="@ours">adb_<xsl:value-of select="@type"/>_t*</xsl:when>
                    <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
                  </xsl:choose>
               </xsl:variable>
@@ -681,11 +606,10 @@
               </xsl:variable>
               <xsl:choose>
                 <xsl:when test="@attribute">
+                <!-- Just waiting for fix the axiom_element_get_attribute 
                   <xsl:choose>
                     <xsl:when test="@nsuri and @nsuri != ''">
-                      qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>","<xsl:choose>
-                                                                   <xsl:when test="@prefix!=''"><xsl:value-of select="@prefix"/></xsl:when>
-                                                                   <xsl:when test="$nsuri and $nsuri != '' and @nsuri=$nsuri"><xsl:value-of select="../@nsprefix"/></xsl:when></xsl:choose>");
+                      qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>", NULL);
                     </xsl:when>
                     <xsl:otherwise>
                       qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", NULL, NULL);
@@ -699,9 +623,50 @@
                   }
                   else
                   {
-                    /** hope this work */
                     attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "<xsl:value-of select="$propertyName"/>");
                   }
+                  if(qname)
+                  {
+                     axutil_qname_free(qname, env);
+                  } -->
+                
+                  parent_attri = NULL;
+                  attrib_text = NULL;
+                  if(attribute_hash)
+                  {
+                       axutil_hash_index_t *hi;
+                       void *val;
+                       const void *key;
+
+                       for (hi = axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi)) 
+                       {
+                           axutil_hash_this(hi, &amp;key, NULL, &amp;val);
+                           
+                           <xsl:choose>
+                             <xsl:when test="@nsuri and @nsuri != ''">
+                               if(strstr((axis2_char_t*)key, "<xsl:value-of select="$propertyName"/>|<xsl:value-of select="@nsuri"/>"))
+                             </xsl:when>
+                             <xsl:otherwise>
+                               if(!strcmp((axis2_char_t*)key, "<xsl:value-of select="$propertyName"/>"))
+                             </xsl:otherwise>
+                           </xsl:choose>
+                               {
+                                   parent_attri = (axiom_attribute_t*)val;
+                                   break;
+                               }
+                       }
+                  }
+
+                  if(parent_attri)
+                  {
+                    attrib_text = axiom_attribute_get_value(parent_attri, env);
+                  }
+                  else
+                  {
+                    /* this is hoping that attribute is stored in "<xsl:value-of select="$propertyName"/>", this happnes when name is in default namespace */
+                    attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "<xsl:value-of select="$propertyName"/>");
+                  }
+
                   if(attrib_text != NULL)
                   {
                       <!-- here only simple type possible -->
@@ -775,7 +740,7 @@
                        
                           <!-- we are done extracting info, just set the extracted value to the qname -->
                        
-                           <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+                          <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
                                                     env,
                                                     axutil_qname_create(
                                                           env, 
@@ -836,17 +801,15 @@
                         </xsl:when>
                         <xsl:otherwise>
                           <!--TODO: add new attributes types -->
-                          /** can not handle the attribute type <xsl:value-of select="$nativePropertyType"/>*/
+                          /* can not handle the attribute type <xsl:value-of select="$nativePropertyType"/>*/
                         </xsl:otherwise>
                       </xsl:choose>
                     }
-                    <xsl:if test="not(@nillable)">
+                    <xsl:if test="not(@optional)">
                     else
                     {
                         /* This is not a nillable attribute*/
-                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable attribute <xsl:value-of select="$propertyName"/> missing"
-                                              " %d :: %s", env->error->error_number,
-                                              AXIS2_ERROR_GET_MESSAGE(env->error));
+                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non optional attribute <xsl:value-of select="$propertyName"/> missing");
                         return AXIS2_FAILURE;
                     }
                     </xsl:if>
@@ -870,37 +833,72 @@
                      <xsl:choose>
                        <xsl:when test="not(@isarray)">  <!--not an array so continue normal -->
                            <xsl:choose>
-                             <xsl:when test="../@ordered or not($anon or $istype)"> <!-- since non-anon has just only one sub element-->
+                             <xsl:when test="$ordered or not($anon or $istype)"> <!-- since non-anon has just only one sub element-->
                                <xsl:choose>
                                  <xsl:when test="position()=1">
                                    current_node = first_node;
+                                   <!-- Wait until AXIOM_ELEMENT -->
+                                   while(current_node &amp;&amp; axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
+                                   {
+                                       current_node = axiom_node_get_next_sibling(current_node, env);
+                                   }
+                                   if(current_node != NULL)
+                                   {
+                                       current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env);
+                                       qname = axiom_element_get_qname(current_element, env, current_node);
+                                   }
                                  </xsl:when>
                                  <xsl:otherwise>
-                                   /**
+                                    /*
                                      * because elements are ordered this works fine
                                      */
+                                  
                                    <!-- current node should contain the ordered value -->
-                                   if(current_node != NULL)
+                                   if(current_node != NULL &amp;&amp; is_early_node_valid)
                                    {
                                        current_node = axiom_node_get_next_sibling(current_node, env);
+                                       <!-- Wait until AXIOM_ELEMENT -->
+                                       while(current_node &amp;&amp; axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
+                                       {
+                                           current_node = axiom_node_get_next_sibling(current_node, env);
+                                       }
+                                       if(current_node != NULL)
+                                       {
+                                           current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env);
+                                           qname = axiom_element_get_qname(current_element, env, current_node);
+                                       }
                                    }
+                                   is_early_node_valid = AXIS2_FALSE;
+                                 </xsl:otherwise>
+                               </xsl:choose> <!-- close for position -1 -->
+
+                               <xsl:choose>
+                                 <xsl:when test="@nsuri and @nsuri != ''">
+                                 element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>", NULL);
+                                 </xsl:when>
+                                 <xsl:otherwise>
+                                 element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", NULL, NULL);
                                  </xsl:otherwise>
                                </xsl:choose>
+
                              </xsl:when>
-                             <xsl:otherwise>
-                                   /**
-                                     * because elements are not ordered we should surf all the sibling to pick the right one
-                                     */
+                             <xsl:otherwise> <!-- otherwise for ($ordered), -->
+                               /*
+                                * because elements are not ordered we should surf all the sibling to pick the right one
+                                */
                                for (current_node = first_node; current_node != NULL;
                                              current_node = axiom_node_get_next_sibling(current_node, env))
                                {
+                                  if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
+                                  {
+                                     continue;
+                                  }
+                                  
                                   current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env);
                                   qname = axiom_element_get_qname(current_element, env, current_node);
                                 <xsl:choose>
                                   <xsl:when test="@nsuri and @nsuri != ''">
-                                  element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>", "<xsl:choose>
-                                                                   <xsl:when test="@prefix!=''"><xsl:value-of select="@prefix"/></xsl:when>
-                                                                   <xsl:when test="@nsuri=../@nsuri"><xsl:value-of select="../@nsprefix"/></xsl:when></xsl:choose>");
+                                  element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>", NULL);
                                   </xsl:when>
                                   <xsl:otherwise>
                                   element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", NULL, NULL);
@@ -908,30 +906,27 @@
                                 </xsl:choose>
                                   if (axutil_qname_equals(element_qname, env, qname))
                                   {
-                                       /** found the requried element */
+                                       /* found the requried element */
                                        break;
                                   }
                                }
-                             </xsl:otherwise>
+                             </xsl:otherwise> <!-- close for ../@ordered or not($anon or $istype) -->
                            </xsl:choose>
-                           
-                           if (current_node <xsl:if test="(@minOccurs=0)"> &amp;&amp; axiom_node_get_data_element(current_node, env) &amp;&amp; !axutil_strcmp(&quot;<xsl:value-of select="$propertyName"/>&quot;, 
-                           axiom_element_get_localname((axiom_element_t *)axiom_node_get_data_element(current_node, env), env))
-                           </xsl:if>)
+
+                           if (<xsl:if test="@ours">adb_<xsl:value-of select="@type"/>_is_particle() || </xsl:if> <!-- is particle test should be done here -->
+                                (current_node &amp;&amp; current_element &amp;&amp; axutil_qname_equals(element_qname, env, qname)))
                            {
-                              <xsl:if test="../@ordered or not($anon or $istype)">current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env);</xsl:if>
+                              is_early_node_valid = AXIS2_TRUE;
                               <!-- changes to following choose tag should be changed in another 2 places -->
                                  <xsl:choose>
                                     <xsl:when test="@ours">
                                       element = (void*)adb_<xsl:value-of select="@type"/>_create(env);
 
                                       status =  adb_<xsl:value-of select="@type"/>_deserialize((<xsl:value-of select="$nativePropertyType"/>)element,
-                                                                            env, current_node);
+                                                                            env, &amp;current_node);
                                       if(AXIS2_FAILURE == status)
                                       {
-                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element <xsl:value-of select="$propertyName"/> "
-                                                              " %d :: %s", env->error->error_number,
-                                                              AXIS2_ERROR_GET_MESSAGE(env->error));
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building adb object for element <xsl:value-of select="$propertyName"/>");
                                           return AXIS2_FAILURE;
                                       }
                                       status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
@@ -939,68 +934,53 @@
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='axis2_char_t*'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if>
-                                                status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                   text_value);
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if>
+                                      if(text_value != NULL)
+                                      {
+                                            status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                               text_value);
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                            status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if>
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='axutil_uri_t*'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if> 
-                                                status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                   axutil_uri_parse_string(env, text_value));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if> 
-
+                                      if(text_value != NULL)
+                                      {
+                                          status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                             axutil_uri_parse_string(env, text_value));
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if> 
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='axutil_duration_t*'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if> 
-                                                status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                   axutil_duration_create_from_string(env, text_value));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if> 
-
+                                      if(text_value != NULL)
+                                      {
+                                          status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                             axutil_duration_create_from_string(env, text_value));
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if> 
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='axutil_qname_t*'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if>
+                                      if(text_value != NULL)
+                                      {
                                             prefix_found = AXIS2_FALSE;
                                             for(cp = text_value; *cp; cp ++)
                                             {
@@ -1034,155 +1014,137 @@
                                                           cp, /* cp contain the localname */
                                                           axiom_namespace_get_uri(qname_ns, env),
                                                           axiom_namespace_get_prefix(qname_ns, env)));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if>
+                                       }
+                                       <xsl:if test="not(@nillable)">
+                                         else
+                                         {
+                                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                             status = AXIS2_FAILURE;
+                                         }
+                                       </xsl:if>
 
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='char' or $nativePropertyType='unsigned char'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if>
-                                                status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                    (char)(*text_value));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if>
+                                      if(text_value != NULL)
+                                      {
+                                          status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                             (char)(*text_value));
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if> 
 
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='int' or $nativePropertyType='unsigned int'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if>
-                                                status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                    atoi(text_value));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if>
-
+                                      if(text_value != NULL)
+                                      {
+                                            status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                                   atoi(text_value));
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if> 
                                    </xsl:when>
                                     <xsl:when test="$nativePropertyType='axis2_byte_t'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if>
-                                                status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                    atoi(text_value));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if>
+                                      if(text_value != NULL)
+                                      {
+                                            status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                                   atoi(text_value));
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if> 
 
                                    </xsl:when>
                                     <xsl:when test="$nativePropertyType='short' or $nativePropertyType='unsigned short'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if>
-
-                                               status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                    atoi(text_value));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if>
+                                      if(text_value != NULL)
+                                      {
+                                            status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                                   atoi(text_value));
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if> 
 
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='float'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if>
-                                               status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                     atof(text_value));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if>
+                                      if(text_value != NULL)
+                                      {
+                                            status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                                   atof(text_value));
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if>
 
                                      </xsl:when>
                                     <xsl:when test="$nativePropertyType='double'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if>
-                                               status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                     atof(text_value));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if>
+                                      if(text_value != NULL)
+                                      {
+                                            status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                                   atof(text_value));
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if>
 
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='long' or $nativePropertyType='unsigned long'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                          <xsl:if test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else
-                                            {
-                                          </xsl:if>
-
-                                               status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                     atol(text_value));
-                                          <xsl:if test="not(@nillable)">
-                                            }
-                                          </xsl:if>
-
+                                      if(text_value != NULL)
+                                      {
+                                            status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                                   atol(text_value));
+                                      }
+                                      <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
+                                      }
+                                      </xsl:if>
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='axiom_node_t*'">
-                                      text_value = NULL; /** just to avoid warning */
+                                      text_value = NULL; /* just to avoid warning */
                                       axiom_node_detach(current_node, env);
                                       status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
                                                                       current_node);
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='axis2_bool_t'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                         <xsl:choose>
-                                            <xsl:when test="not(@nillable)">
-                                            if(text_value == NULL)
-                                            {
-                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                                status = AXIS2_FAILURE;
-                                            }
-                                            else if (!strcmp (text_value , "true") || !strcmp (text_value, "TRUE"))
+                                      if(text_value != NULL)
+                                      {
+                                            if (!axutil_strcasecmp(text_value , "true"))
                                             {
                                                 status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
                                                                  AXIS2_TRUE);
@@ -1192,74 +1154,70 @@
                                                 status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
                                                                       AXIS2_FALSE);
                                             }
-                                            </xsl:when>
-                                             <xsl:otherwise>
-                                                if (!strcmp (text_value , "true") || !strcmp (text_value, "TRUE"))
-                                                {
-                                                    status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                      AXIS2_TRUE);
-                                                }
-                                                else
-                                                {
-                                                    status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                      AXIS2_FALSE);
-                                                }
-                                             </xsl:otherwise>
-                                        </xsl:choose>
-                                    </xsl:when>
-                                    <xsl:when test="$nativePropertyType='axutil_date_time_t*'">
-                                      text_value = axiom_element_get_text(current_element, env, current_node);
+                                      }
                                       <xsl:if test="not(@nillable)">
-                                      if(text_value == NULL)
+                                      else
                                       {
                                           AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
                                           status = AXIS2_FAILURE;
                                       }
-                                      else
-                                      {
                                       </xsl:if>
+                                    </xsl:when>
+                                    <xsl:when test="$nativePropertyType='axutil_date_time_t*'">
+                                      text_value = axiom_element_get_text(current_element, env, current_node);
+                                      if(text_value != NULL)
+                                      {
                                           element = (void*)axutil_date_time_create(env);
                                           status = axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env,
                                                                           text_value);
                                           if(AXIS2_FAILURE ==  status)
                                           {
-                                              AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element <xsl:value-of select="$propertyName"/> "
-                                                                  " %d :: %s", env->error->error_number,
-                                                                  AXIS2_ERROR_GET_MESSAGE(env->error));
+                                              if(element != NULL)
+                                              {
+                                                  axutil_date_time_free(element, env);
+                                              }
+                                              AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element <xsl:value-of select="$propertyName"/> ");
                                               return AXIS2_FAILURE;
                                           }
                                           status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
                                                                        (<xsl:value-of select="$nativePropertyType"/>)element);
+                                      }
                                       <xsl:if test="not(@nillable)">
+                                      else
+                                      {
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
                                       }
                                       </xsl:if>
+
                                     </xsl:when>
                                     <xsl:when test="$nativePropertyType='axutil_base64_binary_t*'">
                                       text_value = axiom_element_get_text(current_element, env, current_node);
-                                      <xsl:if test="not(@nillable)">
-                                      if(text_value == NULL)
+                                      if(text_value != NULL)
                                       {
-                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
-                                          status = AXIS2_FAILURE;
+                                          element = (void*)axutil_base64_binary_create(env);
+                                          status = axutil_base64_binary_set_encoded_binary((axutil_base64_binary_t*)element, env,
+                                                                          text_value);
+                                          if(AXIS2_FAILURE ==  status)
+                                          {
+                                              if(element != NULL)
+                                              {
+                                                 axutil_base64_binary_free((axutil_base64_binary_t*)element, env);
+                                              }
+                                              AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element <xsl:value-of select="$propertyName"/> ");
+                                              return AXIS2_FAILURE;
+                                          }
+                                          status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+                                                                       (<xsl:value-of select="$nativePropertyType"/>)element);
                                       }
+                                      <xsl:if test="not(@nillable)">
                                       else
                                       {
-                                      </xsl:if>
-                                      element = (void*)axutil_base64_binary_create(env);
-                                      status = axutil_base64_binary_set_encoded_binary((axutil_base64_binary_t*)element, env,
-                                                                      text_value);
-                                      if(AXIS2_FAILURE ==  status)
-                                      {
-                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element <xsl:value-of select="$propertyName"/> "
-                                                              " %d :: %s", env->error->error_number,
-                                                              AXIS2_ERROR_GET_MESSAGE(env->error));
-                                          return AXIS2_FAILURE;
-                                      }
-                                      status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
-                                                                   (<xsl:value-of select="$nativePropertyType"/>)element);
-                                      <xsl:if test="not(@nillable)">
+                                          AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                          status = AXIS2_FAILURE;
                                       }
                                       </xsl:if>
+
                                     </xsl:when>
                                     <xsl:otherwise>
                                       <!-- TODO: add other types here -->
@@ -1269,21 +1227,21 @@
                                  </xsl:choose>
                                  if(AXIS2_FAILURE ==  status)
                                  {
-                                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for <xsl:value-of select="$propertyName"/> "
-                                                         " %d :: %s", env->error->error_number,
-                                                         AXIS2_ERROR_GET_MESSAGE(env->error));
+                                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for <xsl:value-of select="$propertyName"/> ");
                                      return AXIS2_FAILURE;
                                  }
-                           }
-                           <xsl:if test="not(@nillable) and not(@minOccurs=0)">
-                               else
-                               {
-                                   /** this is not a nillable element*/
-                                   AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element <xsl:value-of select="$propertyName"/> missing"
-                                                         " %d :: %s", env->error->error_number,
-                                                         AXIS2_ERROR_GET_MESSAGE(env->error));
-                                   return AXIS2_FAILURE;
-                               }
+                              }
+                           <xsl:if test="not(@minOccurs=0)">
+                              else
+                              {
+                                  if(element_qname)
+                                  {
+                                      axutil_qname_free(element_qname, env);
+                                  }
+                                  /* this is not a nillable element*/
+                                  AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "non nillable or minOuccrs != 0 element <xsl:value-of select="$propertyName"/> missing");
+                                  return AXIS2_FAILURE;
+                              }
                            </xsl:if>
                         </xsl:when>
                         <xsl:otherwise> <!-- when it is all the way an array -->
@@ -1291,9 +1249,7 @@
                              <xsl:when test="../@ordered or not($anon or $istype)"> <!-- all the elements should follow this -->
                                 <xsl:choose>
                                   <xsl:when test="@nsuri and @nsuri != ''">
-                                    element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>","<xsl:choose>
-                                                                   <xsl:when test="@prefix!=''"><xsl:value-of select="@prefix"/></xsl:when>
-                                                                   <xsl:when test="@nsuri=../@nsuri"><xsl:value-of select="../@nsprefix"/></xsl:when></xsl:choose>");
+                                    element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>", NULL);
                                   </xsl:when>
                                   <xsl:otherwise>
                                     element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", NULL, NULL);
@@ -1303,20 +1259,23 @@
                                              <xsl:when test="position()=1">first_node</xsl:when>
                                              <xsl:otherwise>axiom_node_get_next_sibling(current_node, env)</xsl:otherwise></xsl:choose>; current_node != NULL; current_node = axiom_node_get_next_sibling(current_node, env))
                                {
+                                  if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
+                                  {
+                                     continue;
+                                  }
                                   current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env);
                                   qname = axiom_element_get_qname(current_element, env, current_node);
 
                                   if (axutil_qname_equals(element_qname, env, qname))
                                   {
-                                      if(sequence_broken)
+                                      is_early_node_valid = AXIS2_TRUE;
+                                      if (sequence_broken)
                                       {
-                                        /** found element out of order */
-                                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "elements found out of order for array<xsl:value-of select="$propertyName"/> missing"
-                                                         " %d :: %s", env->error->error_number,
-                                                         AXIS2_ERROR_GET_MESSAGE(env->error));
+                                        /* found element out of order */
+                                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "elements found out of order for array<xsl:value-of select="$propertyName"/> missing");
                                         return AXIS2_FAILURE;
                                       }
-                                      tmp_node = current_node; /** always update the current node */
+                                      tmp_node = current_node; /* always update the current node */
                                       element_found = 1;
                                       <!-- changes to following choose tag should be changed in another 2 places -->
                                      <xsl:choose>
@@ -1324,160 +1283,297 @@
                                           element = (void*)adb_<xsl:value-of select="@type"/>_create(env);
                                           
                                           status =  adb_<xsl:value-of select="@type"/>_deserialize((<xsl:value-of select="$nativePropertyType"/>)element, env,
-                                                                                 current_node);
+                                                                                 &amp;current_node);
                                           
                                           if(AXIS2_FAILURE ==  status)
                                           {
-                                              AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element <xsl:value-of select="$propertyName"/> "
-                                                                  " %d :: %s", env->error->error_number,
-                                                                  AXIS2_ERROR_GET_MESSAGE(env->error));
+                                              AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element <xsl:value-of select="$propertyName"/> ");
                                               return AXIS2_FAILURE;
                                           }
                                           axutil_array_list_add_at(arr_list, env, i, element);
                                         </xsl:when>
                                         <xsl:when test="$nativePropertyType='axis2_char_t*'">
                                           text_value = axiom_element_get_text(current_element, env, current_node);
-                                          axutil_array_list_add_at(arr_list, env, i, (void*)text_value);
+                                          if(text_value != NULL)
+                                          {
+                                              axutil_array_list_add_at(arr_list, env, i, (void*)text_value);
+                                          }
+                                          <xsl:if test="not(@nillable)">
+                                          else
+                                          {
+                                                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL value is set to a non nillable element <xsl:value-of select="$propertyName"/>");
+                                                status = AXIS2_FAILURE;
+                                          }
+                                          </xsl:if>
                                         </xsl:when>
                                         <xsl:when test="$nativePropertyType='axutil_qname_t*'">
                                           text_value = axiom_element_get_text(current_element, env, current_node);
-                                          prefix_found = AXIS2_FALSE;
-                                          for(cp = text_value; *cp; cp ++)

[... 2717 lines stripped ...]


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