Policy policy = new Policy(POLICY_FILE_LOCATION); AntiSamy as = new AntiSamy(); CleanResults cr = as.scan(dirtyInput, policy); System.out.println(cr.getCleanHTML());