How to remove HTML attributes except "src" and "alt" in JAVA

How to remove all attributes from HTML tags to a string except "alt" and "src" using Java?

And then .. how to get content from all the "src" attributes in a string?

:)

+2
source share
2 answers

OK, I decided it somehow.

The HTMLCleaner library is used to parse input data in a valid format.

Then I use the DOM parser to iterate over everything and share all the forbidden tags and attributes.

(and some minor ugly hacks;))

It was a lot of work.

0
source

You can:

, .

+3

All Articles