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 "Baxi, Rinilkumar (TCS)" <ri...@hp.com> on 2008/12/18 15:33:35 UTC

Question regarding removal of a node from its parent

Hello,

      I am using axiom_navigator to traverse an axiom node. Now, I need to remove a specific node from the parent and keep the rest of the tree navigable. For eg;

Initial struct : <a><b>hello</b>I say</a><c>world</c>

After removal of node b: <a>I say</a><c>world</c>

I tried using the function axiom_node_free_tree. The function did release the node but it broke the navigator also.

Could you please suggest some way in which I could remove the node and still be able to move ahead in the tree.

Thanks,
Rinil

RE: Question regarding removal of a node from its parent

Posted by Bill Mitchell <bm...@austin.rr.com>.
Manjula, I think there is something else going on here.
Axiom_node_free_tree performs a detach as the first step of its processing,
so doing an explicit detach before calling it should have no effect.

Looking at the code in axiom_node_navigator, it appears that it intends to
do a depth first search of the tree.  In the context of the example, it
should return in order the text node for "hello", the element node for "b",
the text node for "I say", then the element node for "a".  The only
exception to this depth first search is the root node, as the root node as
the first node returned, not the last.    

Rinil, looking at the code it is not obvious why this should fail, assuming
that the root of the built navigator points above the initial structure you
describe.  I'm not sure what you meant when you wrote "broke the navigator",
but my best suggestion is for you to step through the code in a debug
version and see what is happening.  

Good luck,
Bill Mitchell
wtmitchell3@acm.org

-----Original Message-----
From: Manjula Peiris [mailto:manjula@wso2.com] 
Sent: Thursday, December 18, 2008 9:16 AM
To: Apache AXIS C Developers List
Subject: Re: Question regarding removal of a node from its parent

Rinil,

Call axiom_node_detach(node, env).

-Manjula.


On Thu, 2008-12-18 at 14:33 +0000, Baxi, Rinilkumar (TCS) wrote:
> Hello,
> 
>  
> 
>       I am using axiom_navigator to traverse an axiom node. Now, I
> need to remove a specific node from the parent and keep the rest of
> the tree navigable. For eg;
> 
>  
> 
> Initial struct : <a><b>hello</b>I say</a><c>world</c>
> 
>  
> 
> After removal of node b: <a>I say</a><c>world</c>
> 
>  
> 
> I tried using the function axiom_node_free_tree. The function did
> release the node but it broke the navigator also.
> 
>  
> 
> Could you please suggest some way in which I could remove the node and
> still be able to move ahead in the tree.
> 
>  
> 
> Thanks,
> 
> Rinil
> 
> 




Re: Question regarding removal of a node from its parent

Posted by Manjula Peiris <ma...@wso2.com>.
Rinil,

Call axiom_node_detach(node, env).

-Manjula.


On Thu, 2008-12-18 at 14:33 +0000, Baxi, Rinilkumar (TCS) wrote:
> Hello,
> 
>  
> 
>       I am using axiom_navigator to traverse an axiom node. Now, I
> need to remove a specific node from the parent and keep the rest of
> the tree navigable. For eg;
> 
>  
> 
> Initial struct : <a><b>hello</b>I say</a><c>world</c>
> 
>  
> 
> After removal of node b: <a>I say</a><c>world</c>
> 
>  
> 
> I tried using the function axiom_node_free_tree. The function did
> release the node but it broke the navigator also.
> 
>  
> 
> Could you please suggest some way in which I could remove the node and
> still be able to move ahead in the tree.
> 
>  
> 
> Thanks,
> 
> Rinil
> 
>