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

David Shen dshen at kana.com
Mon Jun 24 12:44:26 PDT 2002


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






More information about the jdom-interest mailing list