use of org.xwiki.xml.html.HTMLCleaner in project xwiki-platform by xwiki.
the class PdfExportImpl method convertToStrictXHtml.
/**
* Cleans up an HTML document, turning it into valid XHTML.
*
* @param input the source HTML to process
* @return the cleaned up source
*/
private String convertToStrictXHtml(String input) {
LOGGER.debug("Cleaning HTML:\n{}", input);
HTMLCleaner cleaner = Utils.getComponent(HTMLCleaner.class);
HTMLCleanerConfiguration config = cleaner.getDefaultConfiguration();
List<HTMLFilter> filters = new ArrayList<HTMLFilter>(config.getFilters());
filters.add(Utils.getComponent(HTMLFilter.class, "uniqueId"));
config.setFilters(filters);
String result = HTMLUtils.toString(cleaner.clean(new StringReader(input), config));
LOGGER.debug("Cleaned XHTML:\n{}", result);
return result;
}
Aggregations