You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2008/01/15 17:22:27 UTC
svn commit: r612147 [3/17] - in /webservices/axis2/branches/java/jaxws21: ./
modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/
modules/adb-codegen/src/org/apache/axis2/schema...
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=612147&r1=612146&r2=612147&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 Tue Jan 15 08:21:22 2008
@@ -23,6 +23,7 @@
<xsl:template match="class">
<xsl:variable name="name">_<xsl:value-of select="@name"/></xsl:variable>
+ <xsl:variable name="just_name"><xsl:value-of select="@name"/></xsl:variable>
<xsl:variable name="axis2_name">adb_<xsl:value-of select="@name"/></xsl:variable>
<xsl:variable name="istype"><xsl:value-of select="@type"/></xsl:variable>
@@ -34,6 +35,9 @@
<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:variable name="simple"><xsl:value-of select="@simple"/></xsl:variable>
+ <xsl:variable name="choice"><xsl:value-of select="@choice"/></xsl:variable>
+
/**
* <xsl:value-of select="$axis2_name"/>.c
*
@@ -82,7 +86,24 @@
<!-- 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>
+
+ <!-- The section covers the storage for list types, -->
+ <xsl:for-each select="itemtype">
+ <xsl:variable name="propertyType">axutil_array_list_t*</xsl:variable>
+ <xsl:variable name="propertyName"><xsl:value-of select="$just_name"></xsl:value-of></xsl:variable>
+ <xsl:variable name="CName"><xsl:value-of select="$just_name"></xsl:value-of></xsl:variable>
+
+ <xsl:value-of select="$propertyType"/><xsl:text> </xsl:text>property_<xsl:value-of select="$CName"/>;
+ <xsl:text>axis2_bool_t is_valid_</xsl:text><xsl:value-of select="$CName"/>;
+
</xsl:for-each>
+
+
+ <xsl:if test="$choice">
+ axis2_char_t *current_choice;
+ </xsl:if>
};
@@ -110,7 +131,7 @@
<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:when test="@type='unsigned char' or @type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @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>
@@ -122,14 +143,16 @@
</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"/>,
+ <xsl:if test="@isarray">
+ 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);
+ </xsl:if>
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"/>,
+ <xsl:value-of select="$axis2_name"/>_t*<xsl:text> </xsl:text><xsl:value-of select="$name"/>,
const axutil_env_t *env);
</xsl:if>
@@ -137,7 +160,7 @@
/************************* Function Implmentations ********************************/
- AXIS2_EXTERN <xsl:value-of select="$axis2_name"/>_t* AXIS2_CALL
+ <xsl:value-of select="$axis2_name"/>_t* AXIS2_CALL
<xsl:value-of select="$axis2_name"/>_create(
const axutil_env_t *env)
{
@@ -188,6 +211,10 @@
<xsl:value-of select="$name"/>->qname = qname;
</xsl:if>
+ <xsl:if test="$choice">
+ <xsl:value-of select="$name"/>->current_choice = "";
+ </xsl:if>
+
return <xsl:value-of select="$name"/>;
}
@@ -210,6 +237,12 @@
<xsl:value-of select="$axis2_name"/>_reset_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env);
</xsl:for-each>
+ <!-- The section covers the list types -->
+ <xsl:for-each select="itemtype">
+ <xsl:variable name="CName"><xsl:value-of select="$just_name"></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)">
if(<xsl:value-of select="$name"/>->qname)
{
@@ -239,11 +272,22 @@
<xsl:if test="property/@type='axutil_date_time_t*' or property/@type='axutil_base64_binary_t*'">
void *element = NULL;
</xsl:if>
- <xsl:if test="property/@type='axutil_qname_t*'">
+ <xsl:if test="itemtype/@type='axutil_date_time_t*' or itemtype/@type='axutil_base64_binary_t*'">
+ void *element = NULL;
+ </xsl:if>
+ <xsl:if test="property/@type='axutil_qname_t*' or itemtype/@type='axutil_qname_t*'">
axis2_char_t *cp = NULL;
axis2_bool_t prefix_found = AXIS2_FALSE;
axiom_namespace_t *qname_ns;
</xsl:if>
+
+ <xsl:if test="itemtype">
+ int i;
+ axis2_char_t *token_value = NULL;
+ axis2_char_t *original_node_value = NULL;
+ axis2_bool_t the_last_token = AXIS2_FALSE;
+ </xsl:if>
+
<xsl:for-each select="property"> <!-- only one property would be in a simpletype -->
<xsl:variable name="propertyType">
<xsl:choose>
@@ -323,13 +367,13 @@
if(prefix_found)
{
/* node value contain the prefix */
- qname_ns = axiom_element_find_namespace_uri(axiom_node_get_data_element(parent, env), env, node_value, parent);
+ qname_ns = axiom_element_find_namespace_uri((axiom_element_t*)axiom_node_get_data_element(parent, env), env, node_value, parent);
}
else
{
/* Then it is the default namespace */
cp = node_value;
- qname_ns = axiom_element_get_default_namespace(axiom_node_get_data_element(parent, env), env, parent);
+ qname_ns = axiom_element_get_default_namespace((axiom_element_t*)axiom_node_get_data_element(parent, env), env, parent);
}
<!-- we are done extracting info, just set the extracted value to the qname -->
@@ -399,6 +443,190 @@
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
+
+ <!-- The section covers the list types, this is a loop always occurs just 1 time-->
+ <xsl:for-each select="itemtype">
+ <xsl:variable name="propertyType">axutil_array_list_t*</xsl:variable>
+ <xsl:variable name="propertyName"><xsl:value-of select="$just_name"></xsl:value-of></xsl:variable>
+ <xsl:variable name="CName"><xsl:value-of select="$just_name"></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='unsigned char' or @type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @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="propertyInstanceName">(<xsl:value-of select="$nativePropertyType"/>)element</xsl:variable>
+ <xsl:variable name="justPropertyInstanceName">element</xsl:variable>
+
+ /* just to make sure we are not altering the original */
+ node_value = original_node_value = (axis2_char_t*)axutil_strdup(env, node_value);
+
+ for(token_value = node_value, the_last_token = AXIS2_FALSE; !the_last_token; node_value ++)
+ {
+ if(*node_value == ' ' || *node_value == '\t' || *node_value == '\r'
+ || *node_value == '\n' || *node_value == '\0')
+ {
+ if(*node_value == '\0')
+ {
+ the_last_token = AXIS2_TRUE;
+ }
+ else
+ {
+ *node_value = '\0';
+ }
+
+
+ <xsl:choose>
+ <!-- add int s -->
+ <xsl:when test="$nativePropertyType='int' or $nativePropertyType='unsigned int'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atoi(token_value));
+ </xsl:when>
+
+ <!-- add axis2_char_t s -->
+ <xsl:when test="$nativePropertyType='char' or $nativePropertyType='unsigned char'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, (char)(*token_value)); <!-- This should be checked -->
+ </xsl:when>
+
+ <!-- add short s -->
+ <xsl:when test="$nativePropertyType='short' or $nativePropertyType='unsigned short'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atoi(token_value));
+ </xsl:when>
+
+ <!-- add long s -->
+ <xsl:when test="$nativePropertyType='long' or $nativePropertyType='unsigned long'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atol(token_value));
+ </xsl:when>
+
+ <!-- add float s -->
+ <xsl:when test="$nativePropertyType='float'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atof(token_value));
+ </xsl:when>
+ <!-- add double s -->
+ <xsl:when test="$nativePropertyType='double'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atof(token_value));
+ </xsl:when>
+
+ <!-- add axis2_char_t s -->
+ <xsl:when test="$nativePropertyType='axis2_char_t*'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, token_value);
+ </xsl:when>
+
+ <!-- add axutil_qname_t s -->
+ <xsl:when test="$nativePropertyType='axutil_qname_t*'">
+ prefix_found = AXIS2_FALSE;
+ for(cp = token_value; *cp; cp ++)
+ {
+ if(*cp == ':')
+ {
+ *cp = '\0';
+ cp ++;
+ prefix_found = AXIS2_TRUE;
+ break;
+ }
+ }
+
+ if(prefix_found)
+ {
+ /* node value contain the prefix */
+ qname_ns = axiom_element_find_namespace_uri((axiom_element_t*)axiom_node_get_data_element(parent, env), env, token_value, parent);
+ }
+ else
+ {
+ /* Then it is the default namespace */
+ cp = token_value;
+ qname_ns = axiom_element_get_default_namespace((axiom_element_t*)axiom_node_get_data_element(parent, env), env, parent);
+ }
+
+ <!-- we are done extracting info, just set the extracted value to the qname -->
+
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env,
+ axutil_qname_create(
+ env,
+ cp, /* cp contain the localname */
+ axiom_namespace_get_uri(qname_ns, env),
+ axiom_namespace_get_prefix(qname_ns, env)));
+ </xsl:when>
+
+ <!-- add axutil_uri_t s -->
+ <xsl:when test="$nativePropertyType='axutil_uri_t*'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, axutil_uri_parse_string(env, token_value));
+ </xsl:when>
+
+ <!-- add axutil_duration_t s -->
+ <xsl:when test="$nativePropertyType='axutil_duration_t*'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, axutil_duration_create_from_string(env, token_value));
+ </xsl:when>
+
+ <!-- add axis2_bool_t s -->
+ <xsl:when test="$nativePropertyType='axis2_bool_t'">
+ if (!axutil_strcmp(token_value, "TRUE") || !axutil_strcmp(token_value, "true"))
+ {
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, AXIS2_TRUE);
+ }
+ else
+ {
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, AXIS2_FALSE);
+ }
+ </xsl:when>
+ <!-- add axis2_byte_t s -->
+ <xsl:when test="$nativePropertyType='axis2_byte_t'">
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atoi(token_value));
+ </xsl:when>
+ <!-- add date_time_t* s -->
+ <xsl:when test="$nativePropertyType='axutil_date_time_t*'">
+ element = (void*)axutil_date_time_create(env);
+ axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env,
+ token_value);
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, (<xsl:value-of select="$nativePropertyType"/>)element);
+ </xsl:when>
+ <!-- add hex_binary_t* s -->
+ <xsl:when test="$nativePropertyType='axutil_base64_binary_t*'">
+ element = (void*)axutil_base64_binary_create(env);
+ axutil_base64_binary_add_encoded_binary((<xsl:value-of select="$nativePropertyType"/>)element, env,
+ token_value);
+ <xsl:value-of select="$axis2_name"/>_add_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, (<xsl:value-of select="$nativePropertyType"/>)element);
+ </xsl:when>
+ <xsl:when test="@ours">
+ <!-- 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;
+ </xsl:otherwise>
+ </xsl:choose>
+ token_value = node_value + 1;
+ }
+ }
+ AXIS2_FREE(env->allocator, original_node_value);
+
+ </xsl:for-each>
return status;
}
</xsl:if>
@@ -407,7 +635,9 @@
<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 **dp_parent)
+ axiom_node_t **dp_parent,
+ axis2_bool_t *dp_is_early_node_valid,
+ axis2_bool_t dont_care_minoccurs)
{
axiom_node_t *parent = *dp_parent;
@@ -425,12 +655,10 @@
</xsl:if>
<!-- these two are requried -->
- <xsl:for-each select="property">
- <xsl:if test="position()=1"> <!-- check for at least one element exists -->
+ <xsl:if test="count(property)!=0 or count(itemtype)!=0"> <!-- check for at least one element exists -->
axis2_char_t* text_value = NULL;
axutil_qname_t *qname = NULL;
- </xsl:if>
- </xsl:for-each>
+ </xsl:if>
<!-- qname specifc values -->
<xsl:if test="property/@type='axutil_qname_t*'">
@@ -439,7 +667,7 @@
axiom_namespace_t *qname_ns;
</xsl:if>
<xsl:choose>
- <xsl:when test="@simple">
+ <xsl:when test="@simple and (count(property)!=0 or count(itemtype)!=0)">
axiom_element_t *text_element = NULL;
axiom_node_t *text_node = NULL;
@@ -466,13 +694,13 @@
int element_found = 0;
axutil_array_list_t *arr_list = NULL;
</xsl:if>
- <xsl:if test="@ordered and property/@isarray">
+ <xsl:if test="(@ordered or @choice) and property/@isarray">
int sequence_broken = 0;
axiom_node_t *tmp_node = 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)">
+ <xsl:if test="(not(@attribute) and @isarray) or not($ordered)">
yes
</xsl:if>
</xsl:for-each>
@@ -481,12 +709,8 @@
<!-- TODO axutil_qname_t *element_qname = NULL; -->
</xsl:if>
axutil_qname_t *element_qname = NULL;
- <xsl:for-each select="property">
- <xsl:if test="position()=1">
+ <xsl:if test="count(property)!=0">
axiom_node_t *first_node = 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;
@@ -519,7 +743,7 @@
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))
+ if (axutil_qname_equals(qname, env, <xsl:value-of select="$name"/>-> qname)<xsl:if test="not($nsuri) or $nsuri=''"> || !axutil_strcmp("<xsl:value-of select="$originalName"/>", axiom_element_get_localname(current_element, env))</xsl:if>)
{
<xsl:choose>
<xsl:when test="$anon">
@@ -534,9 +758,9 @@
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"Failed in building adb object for <xsl:value-of select="$originalName"/> : "
- "Expected %s but returned %s",
- axutil_qname_to_string(qname, env),
- axutil_qname_to_string(<xsl:value-of select="$name"/>-> qname, env));
+ "Expected %s but returned %s",
+ axutil_qname_to_string(<xsl:value-of select="$name"/>-> qname, env),
+ axutil_qname_to_string(qname, env));
<!-- TODO: ADB specific error should be defined and set here -->
return AXIS2_FAILURE;
}
@@ -729,13 +953,13 @@
if(prefix_found)
{
/* node value contain the prefix */
- qname_ns = axiom_element_find_namespace_uri(axiom_node_get_data_element(parent, env), env, attrib_text, parent);
+ qname_ns = axiom_element_find_namespace_uri((axiom_element_t*)axiom_node_get_data_element(parent, env), env, attrib_text, parent);
}
else
{
/* Then it is the default namespace */
cp = attrib_text;
- qname_ns = axiom_element_get_default_namespace(axiom_node_get_data_element(parent, env), env, parent);
+ qname_ns = axiom_element_get_default_namespace((axiom_element_t*)axiom_node_get_data_element(parent, env), env, parent);
}
<!-- we are done extracting info, just set the extracted value to the qname -->
@@ -795,7 +1019,7 @@
</xsl:when>
<xsl:when test="@ours">
element = (void*)adb_<xsl:value-of select="@type"/>_create(env);
- adb_<xsl:value-of select="@type"/>_deserialize_from_string(element, env, attrib_text, parent);
+ adb_<xsl:value-of select="@type"/>_deserialize_from_string((<xsl:value-of select="$nativePropertyType"/>)element, env, attrib_text, parent);
<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:when>
@@ -814,7 +1038,7 @@
}
</xsl:if>
</xsl:when>
- <xsl:when test="../@simple"></xsl:when> <!-- just to avoid preceeding code to be parsed in a simple type -->
+ <xsl:when test="$simple"></xsl:when> <!-- just to avoid preceeding code to be parsed in a simple type -->
<xsl:otherwise> <!-- when it is an element not(@attribute) -->
<!-- handles arrays -->
<xsl:if test="@isarray">
@@ -829,24 +1053,27 @@
* building <xsl:value-of select="$propertyName"/> element
*/
<!-- array and non array build is so different so big choose, when is requried-->
- <!-- the method of picking the element is depend on the ../@ordered -->
+ <!-- the method of picking the element is depend on the $ordered -->
<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) or $choice"> <!-- since non-anon and choices has just only one sub element-->
<xsl:choose>
<xsl:when test="position()=1">
current_node = first_node;
+ is_early_node_valid = AXIS2_FALSE;
<!-- Wait until AXIOM_ELEMENT -->
- while(current_node && 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:if test="not(@any)">
+ while(current_node && 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:if>
</xsl:when>
<xsl:otherwise>
/*
@@ -858,21 +1085,24 @@
{
current_node = axiom_node_get_next_sibling(current_node, env);
<!-- Wait until AXIOM_ELEMENT -->
- while(current_node && 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:if test="not(@any)">
+ while(current_node && 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:if>
}
is_early_node_valid = AXIS2_FALSE;
</xsl:otherwise>
</xsl:choose> <!-- close for position -1 -->
<xsl:choose>
+ <xsl:when test="@any"></xsl:when>
<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>
@@ -904,33 +1134,38 @@
element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", NULL, NULL);
</xsl:otherwise>
</xsl:choose>
- if (axutil_qname_equals(element_qname, env, qname))
+ if (axutil_qname_equals(element_qname, env, qname)<xsl:if test="not(@nsuri) or @nsuri=''"> || !axutil_strcmp("<xsl:value-of select="$propertyName"/>", axiom_element_get_localname(current_element, env))</xsl:if>)
{
/* found the requried element */
break;
}
}
- </xsl:otherwise> <!-- close for ../@ordered or not($anon or $istype) -->
+ </xsl:otherwise> <!-- close for $ordered or not($anon or $istype) -->
</xsl:choose>
if (<xsl:if test="@ours">adb_<xsl:value-of select="@type"/>_is_particle() || </xsl:if> <!-- is particle test should be done here -->
- (current_node && current_element && axutil_qname_equals(element_qname, env, qname)))
+ (current_node <xsl:if test="not(@any)"> && current_element && (axutil_qname_equals(element_qname, env, qname)<xsl:if test="not(@nsuri) or @nsuri=''"> || !axutil_strcmp("<xsl:value-of select="$propertyName"/>", axiom_element_get_localname(current_element, env))</xsl:if>)</xsl:if>))
{
- is_early_node_valid = AXIS2_TRUE;
+ if( current_node <xsl:if test="not(@any)"> && current_element && (axutil_qname_equals(element_qname, env, qname)<xsl:if test="not(@nsuri) or @nsuri=''"> || !axutil_strcmp("<xsl:value-of select="$propertyName"/>", axiom_element_get_localname(current_element, env))</xsl:if>)</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, &current_node, &is_early_node_valid, <xsl:choose><xsl:when test="$choice">AXIS2_TRUE</xsl:when><xsl:otherwise>AXIS2_FALSE</xsl:otherwise></xsl:choose>);
if(AXIS2_FAILURE == status)
{
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,
+ else
+ {
+ 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:when>
<xsl:when test="$nativePropertyType='axis2_char_t*'">
text_value = axiom_element_get_text(current_element, env, current_node);
@@ -1136,9 +1371,32 @@
</xsl:when>
<xsl:when test="$nativePropertyType='axiom_node_t*'">
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:choose>
+ <xsl:when test="@any">
+ {
+ axiom_node_t *current_property_node = current_node;
+ current_node = axiom_node_get_next_sibling(current_node, env);
+ axiom_node_detach(current_property_node, env);
+ status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+ current_property_node);
+ }
+ </xsl:when>
+ <xsl:otherwise>
+ if(axiom_node_get_first_child(current_node, env))
+ {
+ axiom_node_t *current_property_node = axiom_node_get_first_child(current_node, env);
+ axiom_node_detach(current_property_node, env);
+ status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+ current_property_node);
+ }
+ else
+ {
+ status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+ NULL);
+ }
+ </xsl:otherwise>
+ </xsl:choose>
+
</xsl:when>
<xsl:when test="$nativePropertyType='axis2_bool_t'">
text_value = axiom_element_get_text(current_element, env, current_node);
@@ -1174,13 +1432,15 @@
{
if(element != NULL)
{
- axutil_date_time_free(element, env);
+ axutil_date_time_free((axutil_date_time_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,
+ else
+ {
+ 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
@@ -1205,10 +1465,12 @@
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,
+ else
+ {
+ 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
@@ -1228,11 +1490,15 @@
if(AXIS2_FAILURE == status)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in setting the value for <xsl:value-of select="$propertyName"/> ");
+ if(element_qname)
+ {
+ axutil_qname_free(element_qname, env);
+ }
return AXIS2_FAILURE;
}
}
- <xsl:if test="not(@minOccurs=0)">
- else
+ <xsl:if test="not(@minOccurs=0) and not($choice)">
+ else if(!dont_care_minoccurs)
{
if(element_qname)
{
@@ -1245,9 +1511,13 @@
</xsl:if>
</xsl:when>
<xsl:otherwise> <!-- when it is all the way an array -->
+ <xsl:if test="@any">
+ /* 'any' arrays are not handling correctly when there are other elements mixed with the 'any' element. */
+ </xsl:if>
<xsl:choose>
- <xsl:when test="../@ordered or not($anon or $istype)"> <!-- all the elements should follow this -->
+ <xsl:when test="$ordered or not($anon or $istype) or $choice"> <!-- all the elements should follow this -->
<xsl:choose>
+ <xsl:when test="@any"></xsl:when>
<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>
@@ -1255,26 +1525,36 @@
element_qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", NULL, NULL);
</xsl:otherwise>
</xsl:choose>
+
for (i = 0, sequence_broken = 0, tmp_node = current_node = <xsl:choose>
<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))
+ <xsl:otherwise>(is_early_node_valid?axiom_node_get_next_sibling(current_node, env):current_node)</xsl:otherwise></xsl:choose>; current_node != NULL; <xsl:if test="not(@any)">current_node = axiom_node_get_next_sibling(current_node, env)</xsl:if>)
+ <!-- We are not moving current_node to next sibling here if it an any type, because we already have done the move -->
{
if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
{
continue;
}
+ <xsl:if test="not(@any)">
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 (axutil_qname_equals(element_qname, env, qname)<xsl:if test="not(@nsuri) or @nsuri=''"> || !axutil_strcmp("<xsl:value-of select="$propertyName"/>", axiom_element_get_localname(current_element, env))</xsl:if>)
{
+ </xsl:if>
is_early_node_valid = AXIS2_TRUE;
+ <xsl:if test="not(@any)">
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");
+ if(element_qname)
+ {
+ axutil_qname_free(element_qname, env);
+ }
return AXIS2_FAILURE;
}
+ </xsl:if>
tmp_node = current_node; /* always update the current node */
element_found = 1;
<!-- changes to following choose tag should be changed in another 2 places -->
@@ -1283,20 +1563,22 @@
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);
+ &current_node, &is_early_node_valid, <xsl:choose><xsl:when test="$choice">AXIS2_TRUE</xsl:when><xsl:otherwise>AXIS2_FALSE</xsl:otherwise></xsl:choose>);
if(AXIS2_FAILURE == status)
{
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);
+ else
+ {
+ 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);
if(text_value != NULL)
{
- axutil_array_list_add_at(arr_list, env, i, (void*)text_value);
+ axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, text_value));
}
<xsl:if test="not(@nillable)">
else
@@ -1482,10 +1764,10 @@
</xsl:if>
</xsl:when>
<xsl:when test="$nativePropertyType='long' or $nativePropertyType='unsigned long'">
+ text_value = axiom_element_get_text(current_element, env, current_node);
if(text_value != NULL)
{
/* we keeps long in arrays from their pointers */
- text_value = axiom_element_get_text(current_element, env, current_node);
element = AXIS2_MALLOC(env-> allocator, sizeof(long));
(*(<xsl:value-of select="$nativePropertyType"/>*)element) = atol(text_value);
axutil_array_list_add_at(arr_list, env, i, element);
@@ -1500,10 +1782,32 @@
</xsl:when>
<xsl:when test="$nativePropertyType='axiom_node_t*'">
text_value = NULL; /* just to avoid warning */
- axiom_node_detach(current_node, env);
- axutil_array_list_add_at(arr_list, env, i, (void*)current_node);
+ <xsl:choose>
+ <xsl:when test="@any">
+ {
+ axiom_node_t *current_property_node = current_node;
+ current_node = axiom_node_get_next_sibling(current_node, env);
+ axiom_node_detach(current_property_node, env);
+ axutil_array_list_add_at(arr_list, env, i, (void*)current_property_node);
+ }
+ </xsl:when>
+ <xsl:otherwise>
+ if(axiom_node_get_first_child(current_node, env))
+ {
+ axiom_node_t *current_property_node = axiom_node_get_first_child(current_node, env);
+ axiom_node_detach(current_property_node, env);
+ axutil_array_list_add_at(arr_list, env, i, (void*)current_property_node);
+ }
+ else
+ {
+ status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+ NULL);
+ }
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
<xsl:when test="$nativePropertyType='axis2_bool_t'">
+ text_value = axiom_element_get_text(current_element, env, current_node);
if(text_value != NULL)
{
if (!axutil_strcasecmp (text_value , "true"))
@@ -1524,10 +1828,10 @@
</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);
- text_value = axiom_element_get_text(current_element, env, current_node);
status = axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env,
text_value);
if(AXIS2_FAILURE == status)
@@ -1535,9 +1839,11 @@
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;
}
- axutil_array_list_add_at(arr_list, env, i, element);
+ else
+ {
+ axutil_array_list_add_at(arr_list, env, i, element);
+ }
}
<xsl:if test="not(@nillable)">
else
@@ -1548,10 +1854,10 @@
</xsl:if>
</xsl:when>
<xsl:when test="$nativePropertyType='axutil_base64_binary_t*'">
+ text_value = axiom_element_get_text(current_element, env, current_node);
if(text_value != NULL)
{
element = (void*)axutil_base64_binary_create(env);
- text_value = axiom_element_get_text(current_element, env, current_node);
status = axutil_base64_binary_set_encoded_binary((axutil_base64_binary_t*)element, env,
text_value);
if(AXIS2_FAILURE == status)
@@ -1559,9 +1865,11 @@
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;
}
- axutil_array_list_add_at(arr_list, env, i, element);
+ else
+ {
+ axutil_array_list_add_at(arr_list, env, i, element);
+ }
}
<xsl:if test="not(@nillable)">
else
@@ -1579,27 +1887,39 @@
</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"/> ");
+ if(element_qname)
+ {
+ axutil_qname_free(element_qname, env);
+ }
return AXIS2_FAILURE;
}
i ++;
+ <xsl:if test="not(@any)">
}
else
{
sequence_broken = 1;
}
+ </xsl:if>
}
current_node = tmp_node;
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
+ if(0 == axutil_array_list_size(arr_list,env))
+ {
+ axutil_array_list_free(arr_list, env);
+ }
+ else
+ {
+ status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
arr_list);
+ }
</xsl:when>
- <xsl:otherwise> <!-- otherwse for "../@ordered or not($anon or $istype)" -->
+ <xsl:otherwise> <!-- otherwse for "$ordered or not($anon or $istype)" -->
<xsl:choose>
+ <xsl:when test="@any"></xsl:when>
<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>
@@ -1610,18 +1930,23 @@
/*
* because elements are not ordered we should surf all the sibling to pick the right one
*/
- for (i = 0, current_node = first_node; current_node != NULL; current_node = axiom_node_get_next_sibling(current_node, env))
+ <!-- For non-ordered arrays we are not using is_early_node_valid? -->
+ for (i = 0, current_node = first_node; current_node != NULL; <xsl:if test="not(@any)">current_node = axiom_node_get_next_sibling(current_node, env)</xsl:if>)
+ <!-- We are not moving current_node to next sibling here if it an any type, because we already have done the move -->
{
if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
{
continue;
}
+ <xsl:if test="not(@any)">
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 (axutil_qname_equals(element_qname, env, qname)<xsl:if test="not(@nsuri) or @nsuri=''"> || !axutil_strcmp("<xsl:value-of select="$propertyName"/>", axiom_element_get_localname(current_element, env))</xsl:if>)
{
+ </xsl:if>
/* found the requried element */
+ is_early_node_valid = AXIS2_TRUE;
element_found = 1;
<!-- changes to following choose tag should be changed in another 2 places -->
<xsl:choose>
@@ -1629,21 +1954,24 @@
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);
+ &current_node, &is_early_node_valid, <xsl:choose><xsl:when test="$choice">AXIS2_TRUE</xsl:when><xsl:otherwise>AXIS2_FALSE</xsl:otherwise></xsl:choose>);
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;
}
- axutil_array_list_add_at(arr_list, env, i, element);
+ else
+ {
+ 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);
if(text_value != NULL)
{
- axutil_array_list_add_at(arr_list, env, i, (void*)text_value);
+ axutil_array_list_add_at(arr_list, env, i, axutil_strdup(env, text_value));
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1702,6 +2030,7 @@
if(text_value != NULL)
{
axutil_array_list_add_at(arr_list, env, i, (void*)axutil_uri_parse_string(env, text_value));
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1715,6 +2044,7 @@
if(text_value != NULL)
{
axutil_array_list_add_at(arr_list, env, i, (void*)axutil_duration_create_from_string(env, text_value));
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1731,6 +2061,7 @@
element = AXIS2_MALLOC(env-> allocator, 64);
(*(<xsl:value-of select="$nativePropertyType"/>*)element) = (char)(*text_value);
axutil_array_list_add_at(arr_list, env, i, element);
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1747,6 +2078,7 @@
element = AXIS2_MALLOC(env-> allocator, sizeof(int));
(*(<xsl:value-of select="$nativePropertyType"/>*)element) = atoi(text_value);
axutil_array_list_add_at(arr_list, env, i, element);
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1763,6 +2095,7 @@
element = AXIS2_MALLOC(env-> allocator, sizeof(int));
(*(<xsl:value-of select="$nativePropertyType"/>*)element) = atoi(text_value);
axutil_array_list_add_at(arr_list, env, i, element);
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1779,6 +2112,7 @@
element = AXIS2_MALLOC(env-> allocator, sizeof(short));
(*(<xsl:value-of select="$nativePropertyType"/>*)element) = atoi(text_value);
axutil_array_list_add_at(arr_list, env, i, element);
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1795,6 +2129,7 @@
element = AXIS2_MALLOC(env-> allocator, sizeof(float));
(*(<xsl:value-of select="$nativePropertyType"/>*)element) = atof(text_value);
axutil_array_list_add_at(arr_list, env, i, element);
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1811,6 +2146,7 @@
element = AXIS2_MALLOC(env-> allocator, sizeof(double));
(*(<xsl:value-of select="$nativePropertyType"/>*)element) = atof(text_value);
axutil_array_list_add_at(arr_list, env, i, element);
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1827,6 +2163,7 @@
element = AXIS2_MALLOC(env-> allocator, sizeof(long));
(*(<xsl:value-of select="$nativePropertyType"/>*)element) = atol(text_value);
axutil_array_list_add_at(arr_list, env, i, element);
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1837,13 +2174,30 @@
</xsl:when>
<xsl:when test="$nativePropertyType='axiom_node_t*'">
text_value = NULL; /* just to avoid warning */
- axiom_node_detach(current_node, env);
- axutil_array_list_add_at(arr_list, env, i, (void*)current_node);
+ <xsl:choose>
+ <xsl:when test="@any">
+ {
+ axiom_node_t *current_property_node = current_node;
+ current_node = axiom_node_get_next_sibling(current_node, env);
+ axiom_node_detach(current_property_node, env);
+ axutil_array_list_add_at(arr_list, env, i, (void*)current_property_node);
+ }
+ </xsl:when>
+ <xsl:otherwise>
+ if(axiom_node_get_first_child(current_node, env))
+ {
+ axiom_node_t *current_property_node = axiom_node_get_first_child(current_node, env);
+ axiom_node_detach(current_property_node, env);
+ axutil_array_list_add_at(arr_list, env, i, (void*)current_property_node);
+ }
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
<xsl:when test="$nativePropertyType='axis2_bool_t'">
+ text_value = axiom_element_get_text(current_element, env, current_node);
if(text_value != NULL)
{
- if (!strcmp (text_value , "true") || !strcmp (text_value, "TRUE"))
+ if (!axutil_strcasecmp (text_value , "true"))
{
axutil_array_list_add_at(arr_list, env, i, (void*)AXIS2_TRUE);
}
@@ -1851,6 +2205,7 @@
{
axutil_array_list_add_at(arr_list, env, i, (void*)AXIS2_FALSE);
}
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1868,12 +2223,13 @@
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;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element <xsl:value-of select="$propertyName"/> ");
}
- axutil_array_list_add_at(arr_list, env, i, element);
+ else
+ {
+ axutil_array_list_add_at(arr_list, env, i, element);
+ }
+ }
<xsl:if test="not(@nillable)">
else
{
@@ -1892,12 +2248,12 @@
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;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "failed in building element <xsl:value-of select="$propertyName"/> ");
+ }
+ else
+ {
+ axutil_array_list_add_at(arr_list, env, i, element);
}
- axutil_array_list_add_at(arr_list, env, i, element);
}
<xsl:if test="not(@nillable)">
else
@@ -1921,18 +2277,18 @@
{
axutil_qname_free(element_qname, env);
}
- 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;
}
i ++;
+ <xsl:if test="not(@any)">
}
+ </xsl:if>
}
status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
arr_list);
- </xsl:otherwise> <!--closing otherwise for "../@ordered or not($anon or $istype)" -->
+ </xsl:otherwise> <!--closing otherwise for "$ordered or not($anon or $istype)" -->
</xsl:choose> <!-- chooses for ordered or not @ordered or not($anon or $istype)-->
</xsl:otherwise> <!-- closing when it is all the way an array -->
</xsl:choose> <!-- check array or not -->
@@ -1949,6 +2305,7 @@
<xsl:if test="$particleClass">
*dp_parent = current_node;
+ *dp_is_early_node_valid = is_early_node_valid;
</xsl:if>
return status;
}
@@ -2041,6 +2398,11 @@
axis2_char_t *text_value = NULL;
axis2_char_t *qname_uri = NULL;
axis2_char_t *qname_prefix = NULL;
+ <xsl:if test="itemtype">
+ int i;
+ int allocated_len = 0;
+ axis2_char_t *tmp_value;
+ </xsl:if>
<xsl:for-each select="property">
<xsl:variable name="position"><xsl:value-of select="position()"/></xsl:variable>
@@ -2091,7 +2453,7 @@
<!-- add char s -->
<xsl:when test="$nativePropertyType='char' or $nativePropertyType='unsigned char'">
text_value = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT);
- sprintf (text_value, "%d", <xsl:value-of select="$propertyInstanceName"/>);
+ sprintf (text_value, "%c", <xsl:value-of select="$propertyInstanceName"/>);
</xsl:when>
<!-- add short s -->
@@ -2164,7 +2526,7 @@
<!-- add axis2_bool_t s -->
<xsl:when test="$nativePropertyType='axis2_bool_t'">
<!--text_value = (<xsl:value-of select="$propertyInstanceName"/>)?"true":"false";-->
- text_value = (axis2_char_t*)axutil_strdup(env, (<xsl:value-of select="$propertyInstanceName"/>)?"true":"false");
+ text_value = (axis2_char_t*)(axutil_strdup(env, (<xsl:value-of select="$propertyInstanceName"/>)?"true":"false"));
</xsl:when>
<!-- add axis2_date_time_t s -->
<xsl:when test="$nativePropertyType='axutil_date_time_t*'">
@@ -2184,6 +2546,177 @@
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
+
+ <!-- The section covers the list types, this is a loop always occurs just 1 time-->
+ <xsl:for-each select="itemtype">
+ <xsl:variable name="propertyType">axutil_array_list_t*</xsl:variable>
+ <xsl:variable name="propertyName"><xsl:value-of select="$just_name"></xsl:value-of></xsl:variable>
+ <xsl:variable name="CName"><xsl:value-of select="$just_name"></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='unsigned char' or @type='unsigned short' or @type='unsigned long' or @type='unsigned int' or @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="propertyInstanceName">(<xsl:value-of select="$nativePropertyType"/>)element</xsl:variable>
+ <xsl:variable name="justPropertyInstanceName">element</xsl:variable>
+
+ for(i = 0, allocated_len = 2, text_value = (axis2_char_t*) axutil_strdup(env, "");
+ i < <xsl:value-of select="$axis2_name"/>_sizeof_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env); i ++)
+ {
+ <xsl:value-of select="$nativePropertyType"/> element;
+ axis2_char_t *seperator = (i == <xsl:value-of select="$axis2_name"/>_sizeof_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env) - 1)?"":ADB_DEFAULT_LIST_SEPERATOR;
+ element = <xsl:value-of select="$axis2_name"/>_get_<xsl:value-of select="$CName"/>_at(<xsl:value-of select="$name"/>, env, i);
+
+ <xsl:choose>
+ <!-- add int s -->
+ <xsl:when test="$nativePropertyType='int' or $nativePropertyType='unsigned int'">
+ allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%d%s", text_value, element, seperator);
+ </xsl:when>
+ <!-- add axis2_byte_t s -->
+ <xsl:when test="$nativePropertyType='axis2_byte_t'">
+ allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%d%s", text_value, element, seperator);
+ </xsl:when>
+
+ <!-- add char s -->
+ <xsl:when test="$nativePropertyType='char' or $nativePropertyType='unsigned char'">
+ allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%c%s", text_value, element, seperator);
+ </xsl:when>
+
+ <!-- add short s -->
+ <xsl:when test="$nativePropertyType='short' or $nativePropertyType='unsigned short'">
+ allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%d%s", text_value, element, seperator);
+ </xsl:when>
+
+ <!-- add long s -->
+ <xsl:when test="$nativePropertyType='long' or $nativePropertyType='unsigned long'">
+ allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%d%s", text_value, element, seperator);
+ </xsl:when>
+
+ <!-- add float s -->
+ <xsl:when test="$nativePropertyType='float'">
+ allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%f%s", text_value, element, seperator);
+ </xsl:when>
+
+ <!-- add double s -->
+ <xsl:when test="$nativePropertyType='double'">
+ allocated_len += sizeof (axis2_char_t) * ADB_DEFAULT_DIGIT_LIMIT + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%f%s", text_value, element, seperator);
+ </xsl:when>
+
+ <!-- add axis2_char_t* s -->
+ <xsl:when test="$nativePropertyType='axis2_char_t*'">
+ allocated_len += sizeof (axis2_char_t) * axutil_strlen(element) + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%s%s", text_value, element, seperator);
+ </xsl:when>
+
+ <!-- add axutil_uri_t s -->
+ <xsl:when test="$nativePropertyType='axutil_uri_t*'">
+ tmp_value = axutil_uri_to_string(element, env, AXIS2_URI_UNP_OMITUSERINFO);
+ allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator);
+ </xsl:when>
+
+ <!-- add axutil_duration_t s -->
+ <xsl:when test="$nativePropertyType='axutil_duration_t*'">
+ tmp_value = axutil_duration_serialize_duration(element, env);
+ allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator);
+ </xsl:when>
+
+ <!-- add axutil_qname_t s -->
+ <xsl:when test="$nativePropertyType='axutil_qname_t*'">
+ <!-- namespaces are declared in _declare_parent_namespaces -->
+ qname_uri = axutil_qname_get_uri(element, env);
+ if(qname_uri == NULL)
+ {
+ tmp_value = axutil_qname_get_localpart(element, env);
+ allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator);
+ }
+ else
+ {
+ qname_prefix = (axis2_char_t*)axutil_hash_get(namespaces, qname_uri, AXIS2_HASH_STRING);
+ if(qname_prefix != NULL)
+ {
+ tmp_value = axutil_qname_get_localpart(element, env);
+ allocated_len += sizeof (axis2_char_t) * (ADB_DEFAULT_NAMESPACE_PREFIX_LIMIT + 1 +
+ axutil_strlen(tmp_value) + 2);
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+
+ sprintf(text_value, "%s%s:%s%s", text_value, qname_prefix,
+ tmp_value, seperator);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed in serialize_to_string value for <xsl:value-of select="$propertyName"/>, "
+ "Prefix is not declared beofre using");
+ return NULL;
+ }
+ }
+ </xsl:when>
+
+ <!-- add axis2_bool_t s -->
+ <xsl:when test="$nativePropertyType='axis2_bool_t'">
+ <!--text_value = (<xsl:value-of select="$propertyInstanceName"/>)?"true":"false";-->
+ tmp_value = (axis2_char_t*)((element)?"true":"false");
+ allocated_len += sizeof (axis2_char_t) * axutil_strlen(tmp_value) + 1;
+ text_value = (axis2_char_t*) AXIS2_REALLOC (env-> allocator, text_value, allocated_len);
+ sprintf (text_value, "%s%s%s", text_value, tmp_value, seperator);
+ </xsl:when>
+ <!-- add axis2_date_time_t s -->
+ <xsl:when test="$nativePropertyType='axutil_date_time_t*'">
+ tmp_value = axutil_date_time_serialize_date_time(element, env);
[... 1129 lines stripped ...]
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org