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 2007/10/30 13:11:15 UTC
svn commit: r590048 [4/9] - in /webservices/axis2/branches/java/jaxws21:
legal/ 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/sch...
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=590048&r1=590047&r2=590048&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 Oct 30 05:10:34 2007
@@ -48,14 +48,14 @@
<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"/>
+ * 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:value-of select="@nsuri"/> element
+ * implmentation of the <xsl:value-of select="$originalName"/><xsl:if test="$nsuri">|<xsl:value-of select="$nsuri"/></xsl:if> element
*/
</xsl:otherwise>
</xsl:choose>
@@ -73,13 +73,7 @@
<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">
- <xsl:choose>
- <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">
- adb_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:otherwise>
- axis2_<xsl:value-of select="@type"/>_t*</xsl:otherwise>
- </xsl:choose>
+ adb_<xsl:value-of select="@type"/>_t*
</xsl:when>
<xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
</xsl:choose>
@@ -87,7 +81,7 @@
<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:value-of select="$propertyType"/><xsl:text> </xsl:text>attrib_<xsl:value-of select="$CName"/>;
+ <xsl:value-of select="$propertyType"/><xsl:text> </xsl:text>property_<xsl:value-of select="$CName"/>;
</xsl:for-each>
};
@@ -95,7 +89,7 @@
/************************* 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 )
+ const axutil_env_t *env)
{
<xsl:value-of select="$axis2_name"/>_t *<xsl:value-of select="$name"/> = NULL;
<xsl:if test="not(@type)">
@@ -118,17 +112,27 @@
<xsl:variable name="CName"><xsl:value-of select="@cname"></xsl:value-of></xsl:variable>
<xsl:choose>
<xsl:when test="@ours">
- <xsl:value-of select="$name"/>->attrib_<xsl:value-of select="$CName"/> = NULL;
+ <xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/> = NULL;
</xsl:when>
<!-- todo for others -->
</xsl:choose>
</xsl:for-each>
<xsl:if test="not(@type)">
- qname = axutil_qname_create (env,
- "<xsl:value-of select="@originalName"/>",
- "<xsl:value-of select="@nsuri"/>",
- "<xsl:value-of select="@nsprefix"/>");
+ <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"/>");
+ </xsl:when>
+ <xsl:otherwise>
+ qname = axutil_qname_create (env,
+ "<xsl:value-of select="$originalName"/>",
+ NULL,
+ NULL);
+ </xsl:otherwise>
+ </xsl:choose>
<xsl:value-of select="$name"/>->qname = qname;
</xsl:if>
@@ -141,7 +145,6 @@
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> </xsl:text><xsl:value-of select="$name"/>,
const axutil_env_t *env)
{
- <!--<xsl:if test="property/@isarray and (property/@ours or property/@type='axis2_char_t*' or property/@type='axis2_date_time_t*' or property/@type='axis2_base64_binary_t*' or property/@type='axiom_node_t*')">-->
<xsl:if test="property/@isarray">
int i = 0;
int count = 0;
@@ -152,48 +155,39 @@
<xsl:for-each select="property">
<!-- please check all the freeing thing below -->
- <!--<xsl:if test="@isarray or not(@type='short' or @type='int' or @type='char' or @type='long' or @type='double' or @type='float' or @type='axis2_bool_t')">-->
- <xsl:if test="@isarray or @ours or @type='axis2_char_t*' or @type='axutil_qname_t*' or @type='axutil_uri_t*' or @type='axutil_date_time_t*' or @type='axutil_base64_binary_t*'">
+ <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"><xsl:choose>
- <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">
- adb_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:otherwise>
- axis2_<xsl:value-of select="@type"/>_t*</xsl:otherwise>
- </xsl:choose></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"><xsl:choose>
- <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">
- adb_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:otherwise>
- axis2_<xsl:value-of select="@type"/>_t*</xsl:otherwise>
- </xsl:choose></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="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="attriName"><!--these are used in arrays to take the native type-->
+ <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"/>->attrib_<xsl:value-of select="$CName"/></xsl:otherwise>
+ <xsl:otherwise><xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <xsl:variable name="justAttriName"><!--these are used in arrays to take the native type-->
+ <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"/>->attrib_<xsl:value-of select="$CName"/></xsl:otherwise>
+ <xsl:otherwise><xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
@@ -201,59 +195,63 @@
<!-- handles arrays -->
<xsl:if test="@isarray">
- if ( <xsl:value-of select="$name"/>->attrib_<xsl:value-of select="$CName"/> != NULL)
+ if (<xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/> != NULL)
{
- count = axutil_array_list_size( <xsl:value-of select="$name"/>->attrib_<xsl:value-of select="$CName"/>, env);
- for( i = 0; i < count; i ++)
+ count = axutil_array_list_size(<xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/>, env);
+ for(i = 0; i < count; i ++)
{
- element = axutil_array_list_get( <xsl:value-of select="$name"/>->attrib_<xsl:value-of select="$CName"/>, env, 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="$justAttriName"/> != NULL)
+ 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="$attriName"/>, env);
+ adb_<xsl:value-of select="@type"/>_free(<xsl:value-of select="$propertyInstanceName"/>, env);
</xsl:when>
- <xsl:when test="$nativePropertyType='short' or $nativePropertyType='char' or $nativePropertyType='int' or $nativePropertyType='float' or $nativePropertyType='double' or $nativePropertyType='long'">
+ <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);
+ 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="$attriName"/>);
+ 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="$attriName"/>, env );
+ 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="$attriName"/>, env );
+ 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="$attriName"/>, env );
+ 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="$attriName"/>, env );
+ 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="$attriName"/>, env );
+ 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="$attriName"/>, env );
+ axutil_duration_free (<xsl:value-of select="$propertyInstanceName"/>, env);
</xsl:when>
<!--TODO: This should be extended for all the types that should be freed.. -->
@@ -261,21 +259,21 @@
/** This is an unknown type or a primitive. Please free this manually*/
</xsl:otherwise>
</xsl:choose>
- <xsl:value-of select="$justAttriName"/> = NULL;
+ <xsl:value-of select="$justPropertyInstanceName"/> = NULL;
}
<!--/xsl:if-->
<!-- close tags arrays -->
<xsl:if test="@isarray">
}
- axutil_array_list_free( <xsl:value-of select="$name"/>->attrib_<xsl:value-of select="$CName"/>, env);
+ 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:for-each>
<xsl:if test="not(@type)">
- if(<xsl:value-of select="$name"/>->qname )
+ if(<xsl:value-of select="$name"/>->qname)
{
axutil_qname_free (<xsl:value-of select="$name"/>->qname, env);
<xsl:value-of select="$name"/>->qname = NULL;
@@ -284,148 +282,178 @@
if(<xsl:value-of select="$name"/>)
{
- AXIS2_FREE( env->allocator, <xsl:value-of select="$name"/>);
+ AXIS2_FREE(env->allocator, <xsl:value-of select="$name"/>);
<xsl:value-of select="$name"/> = NULL;
}
return AXIS2_SUCCESS;
}
- <xsl:if test="not(@type)"> <!-- this would only generate for elements -->
- axutil_qname_t* AXIS2_CALL
- <xsl:value-of select="$axis2_name"/>_get_qname (
- <xsl:value-of select="$axis2_name"/>_t*<xsl:text> </xsl:text><xsl:value-of select="$name"/>,
- const axutil_env_t *env)
- {
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
- return <xsl:value-of select="$name"/>-> qname;
- }
- </xsl:if>
<xsl:if test="@simple">
axis2_status_t AXIS2_CALL
<xsl:value-of select="$axis2_name"/>_deserialize_from_string(
<xsl:value-of select="$axis2_name"/>_t*<xsl:text> </xsl:text><xsl:value-of select="$name"/>,
const axutil_env_t *env,
- axis2_char_t *node_value)
+ axis2_char_t *node_value,
+ axiom_node_t *parent)
{
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;
</xsl:if>
+ <xsl:if test="property/@type='axutil_qname_t*'">
+ axis2_char_t *cp = NULL;
+ axis2_bool_t prefix_found = AXIS2_FALSE;
+ axiom_namespace_t *qname_ns;
+ </xsl:if>
<xsl:for-each select="property"> <!-- only one property would be in a simpletype -->
<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"><xsl:choose>
- <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">
- adb_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:otherwise>
- axis2_<xsl:value-of select="@type"/>_t*</xsl:otherwise>
- </xsl:choose></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"><xsl:choose>
- <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">
- adb_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:otherwise>
- axis2_<xsl:value-of select="@type"/>_t*</xsl:otherwise>
- </xsl:choose></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="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>
- <!-- here only simple type possible -->
+ <!-- here only simple types possible -->
<xsl:choose>
<!-- add int s -->
- <xsl:when test="$nativePropertyType='int'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
+ <xsl:when test="$nativePropertyType='int' or $nativePropertyType='unsigned int'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
env, atoi(node_value));
</xsl:when>
<!-- add axis2_char_t s -->
- <xsl:when test="$nativePropertyType='char'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
+ <xsl:when test="$nativePropertyType='char' or $nativePropertyType='unsigned char'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
env, (char)(*node_value)); <!-- This should be checked -->
</xsl:when>
<!-- add short s -->
- <xsl:when test="$nativePropertyType='short'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
+ <xsl:when test="$nativePropertyType='short' or $nativePropertyType='unsigned short'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
env, atoi(node_value));
</xsl:when>
<!-- add long s -->
- <xsl:when test="$nativePropertyType='long'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
+ <xsl:when test="$nativePropertyType='long' or $nativePropertyType='unsigned long'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
env, atol(node_value));
</xsl:when>
<!-- add float s -->
<xsl:when test="$nativePropertyType='float'">
- <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, atof(node_value));
</xsl:when>
<!-- add double s -->
<xsl:when test="$nativePropertyType='double'">
- <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, atof(node_value));
</xsl:when>
<!-- add axis2_char_t s -->
<xsl:when test="$nativePropertyType='axis2_char_t*'">
- <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, node_value);
</xsl:when>
- <!-- add axis2_qname_t s -->
+ <!-- add axutil_qname_t s -->
<xsl:when test="$nativePropertyType='axutil_qname_t*'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
- env, axutil_qname_create_from_string( env, node_value));
+ prefix_found = AXIS2_FALSE;
+ for(cp = node_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_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);
+ }
+
+ <!-- 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,
+ 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 axis2_uri_t s -->
+ <!-- add axutil_uri_t s -->
<xsl:when test="$nativePropertyType='axutil_uri_t*'">
- <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_uri_parse_string(env, node_value));
</xsl:when>
+
+ <!-- add axutil_duration_t s -->
+ <xsl:when test="$nativePropertyType='axutil_duration_t*'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, axutil_duration_create_from_string(env, node_value));
+ </xsl:when>
+
<!-- add axis2_bool_t s -->
<xsl:when test="$nativePropertyType='axis2_bool_t'">
- if ( !axutil_strcmp(node_value, "TRUE") || !axutil_strcmp(node_value, "true") )
+ if (!axutil_strcmp(node_value, "TRUE") || !axutil_strcmp(node_value, "true"))
{
- <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, AXIS2_TRUE);
}
else
{
- <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, AXIS2_FALSE);
}
</xsl:when>
+ <!-- add axis2_byte_t s -->
+ <xsl:when test="$nativePropertyType='axis2_byte_t'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atoi(node_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,
+ element = (void*)axutil_date_time_create(env);
+ axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env,
node_value);
- <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, (<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_set_encoded_binary( ( <xsl:value-of select="$nativePropertyType"/>)element, env,
+ element = (void*)axutil_base64_binary_create(env);
+ axutil_base64_binary_set_encoded_binary((<xsl:value-of select="$nativePropertyType"/>)element, env,
node_value);
- <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: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="@ours">
<!-- It seems this is in an unreachable path -->
@@ -453,7 +481,7 @@
axiom_element_t *parent_element = NULL;
axis2_char_t *attrib_text = NULL;
</xsl:if>
- <xsl:if test="property/@ours or (property/@isarray and (property/@type='short' or property/@type='int' or property/@type='char' or property/@type='long' or property/@type='float' or property/@type='double')) or property/@type='axutil_date_time_t*' or property/@type='axutil_base64_binary_t*'">
+ <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;
</xsl:if>
<!-- these two are requried -->
@@ -464,6 +492,13 @@
axutil_qname_t *qname = NULL;
</xsl:if>
</xsl:for-each>
+
+ <!-- qname specifc values -->
+ <xsl:if test="property/@type='axutil_qname_t*'">
+ axis2_char_t *cp = NULL;
+ axis2_bool_t prefix_found = AXIS2_FALSE;
+ axiom_namespace_t *qname_ns;
+ </xsl:if>
<xsl:choose>
<xsl:when test="@simple">
axiom_element_t *text_element = NULL;
@@ -480,7 +515,7 @@
if(text_element && axiom_text_get_value(text_element, env))
{
text_value = (axis2_char_t*)axiom_text_get_value(text_element, env);
- status = <xsl:value-of select="$axis2_name"/>_deserialize_from_string(<xsl:value-of select="$name"/>, env, text_value);
+ status = <xsl:value-of select="$axis2_name"/>_deserialize_from_string(<xsl:value-of select="$name"/>, env, text_value, parent);
}
}
}
@@ -507,23 +542,24 @@
</xsl:if>
</xsl:if>
<xsl:if test="property and (not(@type) or @type='' or property/@attribute)">
- axis2_qname_t *qname = NULL;
+ 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">
+ <xsl:if test="(not(@attribute) and @isarray) or not(../@ordered)">
yes
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="contains($element_qname_var_requred, 'yes')">
- axutil_qname_t *element_qname = NULL;
+ <!-- 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">
axiom_node_t *first_node = NULL;
<!--<xsl:if test="not(../@type) or ../@type='' or property/@attribute">
- axis2_qname_t *qname = NULL;
+ axutil_qname_t *qname = NULL;
</xsl:if>
axiom_node_t *current_node = NULL;
axiom_element_t *current_element = NULL;-->
@@ -535,6 +571,7 @@
</xsl:if>
AXIS2_ENV_CHECK(env, 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,
@@ -542,8 +579,9 @@
"<xsl:value-of select="$nsprefix"/>");
</xsl:if>
</xsl:for-each>
+ </xsl:if>
<xsl:if test="property">
- if ( NULL == parent )
+ if (NULL == parent)
{
/** This should be checked above */
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL elemenet for <xsl:value-of select="$originalName"/>"
@@ -556,13 +594,13 @@
<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 ) )
+ 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))
{
<xsl:choose>
<xsl:when test="$anon">
- first_node = axiom_node_get_first_child( parent, env);
+ first_node = axiom_node_get_first_child(parent, env);
</xsl:when>
<xsl:otherwise>
first_node = parent;
@@ -573,20 +611,22 @@
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"Failed in building adb object for <xsl:value-of select="$originalName"/> : "
- "Wrong XML to deserialize");
- <!-- TODO: ADB specific error should be defiend and set here -->
+ "Expected %s but returned %s",
+ axutil_qname_to_string(qname, env),
+ axutil_qname_to_string(<xsl:value-of select="$name"/>-> qname, env));
+ <!-- TODO: ADB specific error should be defined and set here -->
return AXIS2_FAILURE;
}
</xsl:when>
<xsl:otherwise>
<!-- for types, parent refers to the container element -->
- first_node = axiom_node_get_first_child( parent, env);
+ first_node = axiom_node_get_first_child(parent, env);
if(first_node == NULL)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"Failed in building adb object for <xsl:value-of select="$originalName"/> : "
- "Wrong XML to deserialize");
- <!-- TODO: ADB specific error should be defiend and set here -->
+ "It is expected to have a child element");
+ <!-- TODO: ADB specific error should be defined and set here -->
return AXIS2_FAILURE;
}
</xsl:otherwise>
@@ -600,7 +640,7 @@
<!-- 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">
- parent_element = (axiom_element_t *)axiom_node_get_data_element( parent, env);
+ parent_element = (axiom_element_t *)axiom_node_get_data_element(parent, env);
</xsl:if>
</xsl:for-each>
@@ -609,149 +649,190 @@
<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"><xsl:choose>
- <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">
- adb_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:otherwise>
- axis2_<xsl:value-of select="@type"/>_t*</xsl:otherwise>
- </xsl:choose></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"><xsl:choose>
- <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">
- adb_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
- <xsl:otherwise>
- axis2_<xsl:value-of select="@type"/>_t*</xsl:otherwise>
- </xsl:choose></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="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="attriName"><!--these are used in arrays to take the native type-->
+ <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"/>->attrib_<xsl:value-of select="$CName"/></xsl:otherwise>
+ <xsl:otherwise><xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <xsl:variable name="justAttriName"><!--these are used in arrays to take the native type-->
+ <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"/>->attrib_<xsl:value-of select="$CName"/></xsl:otherwise>
+ <xsl:otherwise><xsl:value-of select="$name"/>->property_<xsl:value-of select="$CName"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="@attribute">
- qname = axutil_qname_create( env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>","<xsl:choose>
+ <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=../@nsuri"><xsl:value-of select="../@nsprefix"/></xsl:when></xsl:choose>");
- parent_attri = axiom_element_get_attribute( parent_element, env, qname);
- if( parent_attri != NULL)
+ <xsl:when test="$nsuri and $nsuri != '' and @nsuri=$nsuri"><xsl:value-of select="../@nsprefix"/></xsl:when></xsl:choose>");
+ </xsl:when>
+ <xsl:otherwise>
+ qname = axutil_qname_create(env, "<xsl:value-of select="$propertyName"/>", NULL, NULL);
+ </xsl:otherwise>
+ </xsl:choose>
+
+ parent_attri = axiom_element_get_attribute(parent_element, env, qname);
+ if(parent_attri != NULL)
{
- attrib_text = axiom_attribute_get_value( parent_attri, env);
+ attrib_text = axiom_attribute_get_value(parent_attri, env);
}
else
{
/** hope this work */
- attrib_text = axiom_element_get_attribute_value_by_name( parent_element, env, "<xsl:value-of select="$propertyName"/>");
+ attrib_text = axiom_element_get_attribute_value_by_name(parent_element, env, "<xsl:value-of select="$propertyName"/>");
}
- if( attrib_text != NULL)
+ if(attrib_text != NULL)
{
<!-- here only simple type possible -->
<xsl:choose>
<!-- add int s -->
- <xsl:when test="$nativePropertyType='int'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
- env, atoi( attrib_text));
+ <xsl:when test="$nativePropertyType='int' or $nativePropertyType='unsigned int'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atoi(attrib_text));
</xsl:when>
<!-- add axis2_char_t s -->
- <xsl:when test="$nativePropertyType='char'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
+ <xsl:when test="$nativePropertyType='char' or $nativePropertyType='unsigned char'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
env, (char)(*attrib_text));
</xsl:when>
<!-- add short s -->
- <xsl:when test="$nativePropertyType='short'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
- env, atoi( attrib_text));
+ <xsl:when test="$nativePropertyType='short' or $nativePropertyType='unsigned short'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atoi(attrib_text));
</xsl:when>
<!-- add long s -->
- <xsl:when test="$nativePropertyType='long'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
- env, atol( attrib_text));
+ <xsl:when test="$nativePropertyType='long' or $nativePropertyType='unsigned long'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atol(attrib_text));
</xsl:when>
<!-- add float s -->
<xsl:when test="$nativePropertyType='float'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
- env, atof( attrib_text));
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atof(attrib_text));
</xsl:when>
<!-- add double s -->
<xsl:when test="$nativePropertyType='double'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
- env, atof( attrib_text));
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atof(attrib_text));
</xsl:when>
<!-- add axis2_char_t s -->
<xsl:when test="$nativePropertyType='axis2_char_t*'">
- <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, attrib_text);
</xsl:when>
- <!-- add axis2_qname_t s -->
+ <!-- add axutil_qname_t s -->
<xsl:when test="$nativePropertyType='axutil_qname_t*'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
- env, axutil_qname_create_from_string( env, attrib_text));
+ prefix_found = AXIS2_FALSE;
+ for(cp = attrib_text; *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_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);
+ }
+
+ <!-- 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,
+ 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 axis2_uri_t s -->
+ <!-- add axutil_uri_t s -->
<xsl:when test="$nativePropertyType='axutil_uri_t*'">
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
- env, axutil_uri_parse_string( env, attrib_text));
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, axutil_uri_parse_string(env, attrib_text));
+ </xsl:when>
+
+ <!-- add axutil_duration_t s -->
+ <xsl:when test="$nativePropertyType='axutil_duration_t*'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, axutil_duration_create_from_string(env, attrib_text));
</xsl:when>
<!-- add axis2_bool_t s -->
<xsl:when test="$nativePropertyType='axis2_bool_t'">
- if ( !axutil_strcmp( attrib_text, "TRUE") || !axutil_strcmp( attrib_text, "true") )
+ if (!axutil_strcmp(attrib_text, "TRUE") || !axutil_strcmp(attrib_text, "true"))
{
- <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, AXIS2_TRUE);
}
else
{
- <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, AXIS2_FALSE);
}
</xsl:when>
+ <xsl:when test="$nativePropertyType='axis2_byte_t'">
+ <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>,
+ env, atoi(attrib_text));
+ </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,
+ element = (void*)axutil_date_time_create(env);
+ axutil_date_time_deserialize_date_time((axutil_date_time_t*)element, env,
attrib_text);
- <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: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>
<!-- add hex_binary_t* s -->
<xsl:when test="$nativePropertyType='axutil_base64_binary_t*'">
- element = (void*)axutil_base64_binary_create( env);
- axutil_base64_binary_set_encoded_binary( ( <xsl:value-of select="$nativePropertyType"/>)element), env,
+ element = (void*)axutil_base64_binary_create(env);
+ axutil_base64_binary_set_encoded_binary((<xsl:value-of select="$nativePropertyType"/>)element), env,
attrib_text);
- <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: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="@ours">
element = (void*)adb_<xsl:value-of select="@type"/>_create(env);
- adb_<xsl:value-of select="@type"/>_deserialize_from_string(element, env, attrib_text);
- <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>,
- env, ( <xsl:value-of select="$nativePropertyType"/>)element);
+ adb_<xsl:value-of select="@type"/>_deserialize_from_string(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>
<xsl:otherwise>
<!--TODO: add new attributes types -->
@@ -762,7 +843,7 @@
<xsl:if test="not(@nillable)">
else
{
- /** this is not a nillable attribute*/
+ /* 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));
@@ -774,14 +855,14 @@
<xsl:otherwise> <!-- when it is an element not(@attribute) -->
<!-- handles arrays -->
<xsl:if test="@isarray">
- /**
+ /*
* building <xsl:value-of select="$CName"/> array
*/
- arr_list = axutil_array_list_create( env, 10);
+ arr_list = axutil_array_list_create(env, 10);
</xsl:if>
<!-- for each non attribute properties there will always be an element-->
- /**
+ /*
* building <xsl:value-of select="$propertyName"/> element
*/
<!-- array and non array build is so different so big choose, when is requried-->
@@ -799,9 +880,9 @@
* because elements are ordered this works fine
*/
<!-- current node should contain the ordered value -->
- if( current_node != NULL)
+ if(current_node != NULL)
{
- current_node = axiom_node_get_next_sibling( current_node, env);
+ current_node = axiom_node_get_next_sibling(current_node, env);
}
</xsl:otherwise>
</xsl:choose>
@@ -810,15 +891,22 @@
/**
* 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))
+ for (current_node = first_node; current_node != NULL;
+ current_node = axiom_node_get_next_sibling(current_node, env))
{
- current_element = (axiom_element_t *)axiom_node_get_data_element( current_node, env);
- qname = axiom_element_get_qname( current_element, env, current_node);
- element_qname = axutil_qname_create( env, "<xsl:value-of select="$propertyName"/>", "<xsl:value-of select="@nsuri"/>", "<xsl:choose>
+ 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>");
- if ( axutil_qname_equals( element_qname, env, qname))
+ </xsl:when>
+ <xsl:otherwise>
+ 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))
{
/** found the requried element */
break;
@@ -827,244 +915,359 @@
</xsl:otherwise>
</xsl:choose>
- if (current_node <xsl:if test="(@minOccurs=0)"> && axiom_node_get_data_element( current_node, env) && !axutil_strcmp("<xsl:value-of select="$propertyName"/>",
- axiom_element_get_localname((axiom_element_t *)axiom_node_get_data_element( current_node, env), env))
+ if (current_node <xsl:if test="(@minOccurs=0)"> && axiom_node_get_data_element(current_node, env) && !axutil_strcmp("<xsl:value-of select="$propertyName"/>",
+ axiom_element_get_localname((axiom_element_t *)axiom_node_get_data_element(current_node, env), env))
</xsl:if>)
{
- <xsl:if test="../@ordered or not($anon or $istype)">current_element = (axiom_element_t *)axiom_node_get_data_element( current_node, env);</xsl:if>
+ <xsl:if test="../@ordered or not($anon or $istype)">current_element = (axiom_element_t *)axiom_node_get_data_element(current_node, env);</xsl:if>
<!-- 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);
+ element = (void*)adb_<xsl:value-of select="@type"/>_create(env);
- status = adb_<xsl:value-of select="@type"/>_deserialize(( <xsl:value-of select="$nativePropertyType"/>)element,
+ status = adb_<xsl:value-of select="@type"/>_deserialize((<xsl:value-of select="$nativePropertyType"/>)element,
env, current_node);
- if( AXIS2_FAILURE == status)
+ 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);
+ 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 );
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
+ 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>
</xsl:when>
- <xsl:when test="$nativePropertyType='axis2_uri_t*'">
- text_value = axiom_element_get_text(current_element, env, current_node );
- 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: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>
+
</xsl:when>
- <xsl:when test="$nativePropertyType='axis2_qname_t*'">
- text_value = axiom_element_get_text(current_element, env, current_node );
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- axutil_qname_create_from_string( env, text_value));
+ <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>
+
</xsl:when>
- <xsl:when test="$nativePropertyType='char'">
- text_value = axiom_element_get_text(current_element, env, current_node );
- <xsl:choose>
- <xsl:when test="@nillable">
+ <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
{
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- (char)(*text_value));
+ </xsl:if>
+ prefix_found = AXIS2_FALSE;
+ for(cp = text_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(current_element, env, text_value, current_node);
+ }
+ else
+ {
+ /* Then it is the default namespace */
+ cp = text_value;
+ qname_ns = axiom_element_get_default_namespace(current_element, env, current_node);
}
+
+ <!-- we are done extracting info, just set the extracted value to the qname -->
+
+ status = <xsl:value-of select="$axis2_name"/>_set_<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:if test="not(@nillable)">
+ }
+ </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
+ </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:otherwise>
- </xsl:choose>
+ <xsl:if test="not(@nillable)">
+ }
+ </xsl:if>
+
</xsl:when>
- <xsl:when test="$nativePropertyType='int'">
- text_value = axiom_element_get_text(current_element, env, current_node );
- <xsl:choose>
- <xsl:when test="@nillable">
+ <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
{
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- atoi( text_value));
+ </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>
- </xsl:when>
- <xsl:otherwise>
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- atoi( text_value));
- </xsl:otherwise>
- </xsl:choose>
</xsl:when>
- <xsl:when test="$nativePropertyType='short'">
- text_value = axiom_element_get_text(current_element, env, current_node );
- <xsl:choose>
- <xsl:when test="@nillable">
+ <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
{
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- atoi( text_value));
+ </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>
+
+ </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>
- </xsl:when>
- <xsl:otherwise>
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- atoi( text_value));
- </xsl:otherwise>
- </xsl:choose>
</xsl:when>
<xsl:when test="$nativePropertyType='float'">
- text_value = axiom_element_get_text(current_element, env, current_node );
- <xsl:choose>
- <xsl:when test="@nillable">
+ 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
{
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- atof( text_value));
+ </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>
- </xsl:when>
- <xsl:otherwise>
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- atof( text_value));
- </xsl:otherwise>
- </xsl:choose>
</xsl:when>
<xsl:when test="$nativePropertyType='double'">
- text_value = axiom_element_get_text(current_element, env, current_node );
- <xsl:choose>
- <xsl:when test="@nillable">
+ 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
{
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- atof( text_value));
+ </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>
- </xsl:when>
- <xsl:otherwise>
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- atof( text_value));
- </xsl:otherwise>
- </xsl:choose>
</xsl:when>
- <xsl:when test="$nativePropertyType='long'">
- text_value = axiom_element_get_text(current_element, env, current_node );
- <xsl:choose>
- <xsl:when test="@nillable">
+ <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
{
- status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>( <xsl:value-of select="$name"/>, env,
- atol( text_value));
+ </xsl:if>
+
+ status = <xsl:value-of select="$axis2_name"/>_set_<xsl:value-of select="$CName"/>(<xsl:value-of select="$name"/>, env,
[... 2339 lines stripped ...]
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org