How do I get a list of all the valid tags of a given Jsoup Whitelist?
I can't find such a function in the docs at Jsoup whitelist docs. I use ColdFusion, but a java solution or hint would be fine. I guess I could translate it.
How do I get a list of all the valid tags of a given Jsoup Whitelist?
I can't find such a function in the docs at Jsoup whitelist docs. I use ColdFusion, but a java solution or hint would be fine. I guess I could translate it.
On
You can check here that, what you are asking for is the tagNames set. The class doesn't provide any getter.
What you can do is:
Whitelist class and add a getter. You can even make a pull request after that.
If you want to go the reflection route, you can do something like below which grabs access to the
tagNamesset, converts it to an array oforg.jsoup.safety.Whitelist$TagNameobjects (which contain the tag names) and then appends thetoString()values of those objects to another array.If you need the attributes and/or protocols fields, it's a similar approach but there is more to iterate through since they are maps.