use of org.apache.xerces.xni.XMLString in project zm-mailbox by Zimbra.
the class HtmlPurifier method purifyText.
/* (non-Javadoc)
* @see org.cyberneko.html.filters.Purifier#purifyText(org.apache.xerces.xni.XMLString)
*/
@Override
protected XMLString purifyText(XMLString text) {
String temp = text.toString();
if (IMG_SKIP_OWASPSANITIZE.matcher(temp).find()) {
return text;
}
if (VALID_IMG_TAG.matcher(temp).find()) {
temp = sanitizer.sanitize(temp);
}
XMLString n = new XMLString();
n.setValues(temp.toCharArray(), 0, temp.length());
return super.purifyText(n);
}
use of org.apache.xerces.xni.XMLString in project zm-mailbox by Zimbra.
the class DefangFilter method characters.
/** Characters. */
@Override
public void characters(XMLString text, Augmentations augs) throws XNIException {
if (mRemovalElementName == null) {
if (mStyleDepth > 0) {
String result = null;
if (!StringUtil.isAsciiString(text.toString())) {
result = extractAndSanitizeAsciiData(text.toString());
} else {
result = sanitizeStyleValue(text.toString());
}
super.characters(new XMLString(result.toCharArray(), 0, result.length()), augs);
} else {
super.characters(text, augs);
}
}
}
Aggregations