You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Samisa Abeysinghe (JIRA)" <ji...@apache.org> on 2007/08/24 11:20:31 UTC
[jira] Commented: (AXIS2C-677) Clone method required for axiom_node
[ https://issues.apache.org/jira/browse/AXIS2C-677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12522448 ]
Samisa Abeysinghe commented on AXIS2C-677:
------------------------------------------
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.
> Clone method required for axiom_node
> ------------------------------------
>
> Key: AXIS2C-677
> URL: https://issues.apache.org/jira/browse/AXIS2C-677
> Project: Axis2-C
> Issue Type: Bug
> Components: xml/om
> Reporter: Jamie Lyon
>
> There is no clone method for axiom_node in the current implementation of axiom/c, it should have one as the axiom/java version does.
> Without a clone method, there is no easy way to alter a tree without affecting the original.
--
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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: [jira] Commented: (AXIS2C-677) Clone method required for axiom_node
Posted by Dumindu Pallewela <du...@wso2.com>.
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
RE: [jira] Commented: (AXIS2C-677) Clone method required for axiom_node
Posted by Jamie Lyon <jl...@it-innovation.soton.ac.uk>.
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. 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?
Thanks,
Jamie
> > Clone method required for axiom_node
> > ------------------------------------
> >
> > Key: AXIS2C-677
> > URL:
https://issues.apache.org/jira/browse/AXIS2C-677
> > Project: Axis2-C
> > Issue Type: Bug
> > Components: xml/om
> > Reporter: Jamie Lyon
> >
> > There is no clone method for axiom_node in the current
implementation of
> axiom/c, it should have one as the axiom/java version does.
> > Without a clone method, there is no easy way to alter a tree without
> affecting the original.
>
> --
> 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: axis-c-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-dev-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org