[ 
https://issues.apache.org/jira/browse/AXIS2C-786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547654
 ] 

Senaka Fernando commented on AXIS2C-786:
----------------------------------------

Hi Edward,

Aren't you setting the text of an axiom_element? If you do so, you in fact 
should have a reference of type axiom_element_t *. Or if you really need to you 
can do this.

axiom_element_t *my_element = (axiom_element_t 
*)axiom_node_get_data_element(my_node, env);

This doesn't involve any memory allocation. Also, the reason for casting is 
axiom_node_get_data_element() returns a (void *). There is a mechanism to know 
whether in fact you do have a node which is a AXIOM_ELEMENT. That is by this 
test:

(axiom_node_get_node_type(my_node, env) == AXIOM_ELEMENT).

However, this additional parameter is included just for consistency. In theory 
what should be removed is (axiom_node_t *) and you should be able to use the 
(axiom_element_t *) to retrieve the (axiom_node_t *). But that doesn't seem to 
be happening. We simply retrieve the element from the node, and therefore you 
can get the (axiom_element_t *) by the method shown above.

I guess it is better that you stick to this method. Because, in the future, if 
we are ever going to use (axiom_element_t *) within this method, we expect that 
you obtain it in this method. Somebody please correct me if I'm wrong.

Hope this helps.

Regards,
Senaka

> axiom_element_set_text() and other functions that do not make use of an 
> axiom_element_t* object in its parameters
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2C-786
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-786
>             Project: Axis2-C
>          Issue Type: Improvement
>          Components: xml/soap
>    Affects Versions: Current (Nightly)
>            Reporter: Edward Liu
>            Priority: Minor
>             Fix For: Current (Nightly)
>
>
> There are some functions, such as axiom_element_set_text(), that take in an 
> axiom_element_t* object as one of its parameters, but does not make use of it 
> (after viewing the Axis2-C source code).  It is pretty inconvenient and 
> unnecessary (in my opinion) to create an axiom_element_t* object, pass it 
> into axiom_element_set_text(), and then free it, without using this object 
> anywhere else except as an argument to a function that doesn't even use the 
> object itself.  I think that this creation and freeing of an axiom_element_t* 
> object could be avoided.  After talking with one of the developers, it is 
> recommended that the axiom_element_t* argument be removed from those 
> functions that have it as a parameter but make no use of it.  I believe that 
> passing NULL into these affected functions is a temporary workaround, not a 
> permanent solution, for this issue.  Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to