Jsoup: Removing Attributes


Jsoup is the coolest library ever.  It can do just about anything.  For cleaning up html, you can .remove() nodes and elements all.  However, it doesn’t have a bulk remove for attributes, that I’ve found.

xtroce over on StackOverflow, found he had to write a method to clean them out. Yeah, that’s the best I can do too. So I thought I’d add it to my Jsoup tool box, with an option to keep the elements id.

Of course no project is complete without a way to run it:




About Author


Steve works with successful software startups and tech companies throughout Silicon Valley. Most recently he has been developing content migration tools for large websites. He has a deep passion for all things software engineering, from design concepts, to team management, to final delivery.

Comments are closed.