[jdom-interest] How to remove a child by specifying the value of an attribute?

Supriyo Chatterjea supriyo_chatterjea at yahoo.com.sg
Sun Aug 11 09:43:29 PDT 2002


I need to remove a child with a certain specific
attribute value, e.g.

I've got the following file:

  <bbb value1="12" value2="12" value3="12">
    <ccc time="9"/>
  <bbb value1="17"  value2="23" value3="57">
    <ccc time="4"/>
  <bbb value1="24"  value2="200" value3="94">
    <ccc time="2"/>

Now suppose I want to remove the child <bbb> of <aaa>
that has an attribute value1=17. So in this case that
would mean removing the 2nd element. How do I remove
an element by specifying not only it's name but also
the value of a certain attribute?

removechild(...) only deletes then first child with
the specified name and namespace.

Would appreciate a short example...
Thanks for the help!

Do You Yahoo!?
Win a DV camera, join our "30 Seconds of Fame" contest   

More information about the jdom-interest mailing list