the nodeName = #text
is the "empty" text between <Doc:Id></Doc:Id>

I think if you play with nodes you could just check that if it has 1
child and the nodeName = #text and theText == "" just remove it.

Marouane

On Thu, 2006-05-04 at 11:28, jadiyo wrote:
> Hi,
> 
> I have the following xml fragment:
> 
>   <Doc:AcctId>
>     <Doc:Id>
>       <Doc:IBAN>SETTLEMENT SOURCE ACCOUNT IBAN</Doc:IBAN>
>     </Doc:Id>
>   </Doc:AcctId>
> 
> I use the following code to remove the IBAN element from the XML
> 
> Node ibanNode = <code to get theNode for the IBAN>
> Node parentNode = ibanNode.getParentNode();
> parentNode.removeChild(ibanNode);
> 
> This works fine, leaving just this :
> 
>   <Doc:AcctId>
>     <Doc:Id></Doc:Id>
>   </Doc:AcctId>
> 
> After we have removed the child, we want to check the parentNode to see
> whether it has more children.  In this case, the Id element doesn't have
> anymore children.
> However, a call to parent.hasChildNodes() return true.
> This is NOT what I expected.  So, I iterated over the child nodes and output
> the node name for each of the the nodes.  I got the following result
> 
> nodeName = #text
> nodeName = #text
>  
> 
> Essentially, what I want to do is remove a child from its parent and remove
> the parent if it has no more children and so on and so forth, but as
> mentioned above, the parent node seems to have unexpected children.
> 
> 
> Thanks in advance for your help
> 
> Jadiyo
> 
> 
> --
> View this message in context: 
> http://www.nabble.com/removeChild-from-parent-problem-t1555677.html#a4225767
> Sent from the Xml Beans - User forum at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to