use of com.smartandroid.sa.tag.nodes.Document in project SmartAndroidSource by jaychou2012.
the class Cleaner method clean.
/**
* Creates a new, clean document, from the original dirty document,
* containing only elements allowed by the whitelist. The original document
* is not modified. Only elements from the dirt document's <code>body</code>
* are used.
*
* @param dirtyDocument
* Untrusted base document to clean.
* @return cleaned document.
*/
public Document clean(Document dirtyDocument) {
Validate.notNull(dirtyDocument);
Document clean = Document.createShell(dirtyDocument.baseUri());
if (// frameset documents won't have a
dirtyDocument.body() != null)
// body. the clean doc will have
// empty body.
copySafeNodes(dirtyDocument.body(), clean.body());
return clean;
}
Aggregations