axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dumindu Pallewela <dumi...@wso2.com>
Subject Re: [jira] Commented: (AXIS2C-677) Clone method required for axiom_node
Date Thu, 30 Aug 2007 07:51:43 GMT
Jamie Lyon wrote:
> Hi,
> 
> See my reply below.
> 
>> -----Original Message-----
>> The C implementation of AXIOM is different form that of Java. Hence,
> it is
>> not easy, if not impossible to implement the clone method. This is
> mainly
>> because of hte linked list model that we have in the C implementation.
>>
>> The workaround for this would be to serialize the tree and use that
> string
>> to create the new tree. This would allow for reuing the same content.
>> Else, you have to adopt the method used in echo sample, where you
> recreate
>> the payload with different parameters.
> 
> This seems acceptable, if not ideal. However there is one problem with
> this -- I am not guaranteed that the namespaces of the current node will
> be defined in that node, they may be defined in some unspecified parent
> node. So the only solution here appears to be to serialize/deserialize
> the entire document.

You may use the canonical xml (c14n) implementation in rampart to include
the necessary namespaces in the serialized node. There are two implementa-
tions, xml-c14n and xml-exclusive-c14n. In the exclusive case only the 
*necessary* namespaces are included in the output. I guess that is what
you need here. Please read more on the differences of the two algorithms,
and decide the one that suits you, if you intend to use it.

> If I was to do this, how do I then find the current
> node to pass on?
>
> Are you guaranteed that the new tree will be parsed in the same order?
> I.e. if I was to search the tree from the root to find the exact path to
> the current node, and then follow the same path in the new document,
> would I reach the same node?
> 
> Would this be an acceptable way of doing things?
> 
> Finally, is it guaranteed that the node returned from the send_receive
> methods will always have a document?
> I.e. Can I guarantee that I can always get the document root by doing:
> axiom_document_t* doc = axiom_node_get_document(node, env);
> axiom_node_t* root = axiom_document_get_root_element(doc, env);
> 
> Or should I simply traverse from the current node up to the root by
> calling axiom_node_get_parent 'til it returns NULL?

IMHO, you need not worry about these if you canonicalize the document, as
it should take care of these.

Regards,
Dumindu.

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


Mime
View raw message