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
Post a Comment