/* Step 2 : Sanitize input */
// --Create AS object using policy loaded
AntiSamy as = new AntiSamy(policy);
// --Scan input data received
CleanResults result = as.scan(req.getParameter("input"), AntiSamy.SAX);
/* Step 3 : Return to user processing information of data received */
html.append("<h1>Input scan result</h1>");
html.append("<ul>");
html.append("<li>");
html.append("Number of errors : ").append(result.getNumberOfErrors());
html.append("</li>");
html.append("<li>");
html.append("Scan time : ").append(result.getScanTime());
html.append("</li>");
html.append("<li>");
html.append("Clean HTML : <br><textarea rows='10' cols='100'>").append(result.getCleanHTML()).append("</textarea>");
html.append("</li>");
html.append("</ul>");
if (!result.getErrorMessages().isEmpty()) {
html.append("<h1>List of detected errors</h1>");
html.append("<ul>");
for (Object o : result.getErrorMessages()) {
html.append("<li>").append(o.toString()).append("</li>");
}
html.append("</ul>");
}