Getting the JARs
Unless maven is managing your CLASSPATH for you, you need to add both
owasp-java-html-sanitizer.jar and the
Once you have your CLASSPATH set up correctly with the relevant JARs you should be able to add
to one of your project's
.java files and compile it.
Using the APIs
The examples include source code which defines a sanitization policy, and applies it to HTML.
Important classes are:
- Sanitizers contains combinable pre-packaged policies.
- HtmlPolicyBuilder lets you easily build custom policies.
For advanced use, see:
- AttributePolicy and ElementPolicy allow complex customization.
- HtmlStreamEventReceiver if you don't just want a
Feel free to post questions at the discussion group and we'll do our best to help.