How to remove a child from from a node using jdom in java?

You'll need to do this: List elements = new ArrayList(); while (subchilditr.hasNext()) { Element subchild = (Element) subchilditr.next(); if (subchild.getText(). EqualsIgnoreCase(text)) { elements. Add(subchild); } } for (Element element : elements) { element.getParent().

RemoveContent(element); } If you try to remove an element inside of the loop you'll get a ConcurrentModificationException.

I tried it..It was successful for the first time..but after that..I started getting null pointer exception. Any idea?! – mad_programmer Apr 13 at 1:44 Well..i got it..I just cleared all the elements arraylist after the for loop.

And it solved my problem. Thanks very much. – mad_programmer Apr 13 at 1:47.

If you have the parent element rurl you can remove its children using the method removeChild or removeChildren.

I don't want to remove all the rurl-link childs..I just want the the a single node to be deleted if it matches my condition. – mad_programmer Apr 13 at 1:29 1 @mad_programmer: element.getParent(). RemoveContent(child) will do the job.

See the class org.jdom. Parent for more information. – Benjamin Muschko Apr 13 at 1:37.

Thanks, but I have to use JDOM for this. – mad_programmer Apr 13 at 1:33.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions