コード例 #1
0
ファイル: NSoup.cs プロジェクト: fengweijp/NSoup
 /// <summary>
 /// Get safe HTML from untrusted input HTML, by parsing input HTML and filtering it through a white-list of
 /// permitted tags and attributes.
 /// </summary>
 /// <param name="bodyHtml">Input untrusted HTML (body fragment)</param>
 /// <param name="baseUri">URL to resolve relative URLs against</param>
 /// <param name="whitelist">White-list of permitted HTML elements</param>
 /// <param name="outputSettings">Document output settings; use to control pretty-printing and entity escape modes</param>
 /// <returns>Safe HTML (body fragment)</returns>
 /// <see cref="Cleaner.Clean(Document)"/>
 public static string Clean(string bodyHtml, string baseUri, Whitelist whitelist, OutputSettings outputSettings)
 {
     Document dirty = ParseBodyFragment(bodyHtml, baseUri);
     Cleaner cleaner = new Cleaner(whitelist);
     Document clean = cleaner.Clean(dirty);
     clean.OutputSettings(outputSettings);
     return clean.Body.Html();
 }