java - JSoup Remove Elements -


even though, may sound basic, ask how remove element doc using jsoup.

i tried searching it, no success.

here problem:

elements mynewelements = doc.getelementsbyattribute("hello");  //now need perform other methods on mynewelements before removing. //hence..suggested method says, doc.getelementsbyattribute("hello").remove(); 

this works fine. believe selecting same elements again , again prove memory hungry. possible ?

doc.select(mynewelements).remove(); 

//try select mynewelements doc.

if didn't add new elements match inital select, don't need select elements again.

each element in elements has reference parent , remove() method tells parent remove child element.

in essence, doing:

mynewelements.remove() 

should work.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -