[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


Hi,

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

I've got the following file:

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

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!
Supriyo

__________________________________________________
Do You Yahoo!?
Win a DV camera, join our "30 Seconds of Fame" contest   
http://sg.movies.yahoo.com



More information about the jdom-interest mailing list