code: public Document clean(Document dirtyDocument) {
          Validate.notNull(dirtyDocument);
  
          Document clean = Document.createShell(dirtyDocument.baseUri());
          if (dirtyDocument.body() != null) // frameset documents won't have a body. the clean doc will have empty body.
              copySafeNodes(dirtyDocument.body(), clean.body());
  
          return clean;
      }
docs: 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.