[jdom-interest] Questions regarding "remove an element"

Stephan Trebels stephan at ncube.de
Mon Jun 24 13:11:42 PDT 2002


You should get the Element using carElement.getChild("model"). 
The rest is active lists and iterators.

Stephan

On Mon, Jun 24, 2002 at 12:44:26PM -0700, David Shen wrote:
> I have the following xml
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <car>
>   <make>toyota</make>
>   <model>Celica</model>
> </car>
> 
> I would like to remove the child, "<model>Celica</model>"
> How do I do it?  Is there any sample?
> 
> I try to do the following but it doesn't work.
> 
> Element modelCelicaElemant = carElement.getChild("model.Celica");
> List children = carElement.getChildren();
> children.remove(modelCelicaElemant);
> 
> Thanks
> 
> David
> 
> 
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

-- 
           Stephan Trebels <stephan at ncube.de>, Consultant
mail: nCUBE Deutschland GmbH, Hanauer Str. 56, 80992 Munich, Germany
phone: +49 89 149893 0  cell: +49 172 8433111  fax: +49 89 149893 50 



More information about the jdom-interest mailing list