C# Class NExtends.Helpers.HtmlUtility

This is an HTML cleanup utility combining the benefits of the HtmlAgilityPack to parse raw HTML and the AntiXss library to remove potentially dangerous user input. Additionally it uses a list created by Robert Beal to limit the number of allowed tags and attributes to a sensible level
ファイルを表示 Open project: LuccaSA/NExtends

Public Methods

Method Description
SanitizeHtml ( string source ) : string

Takes raw HTML input and cleans against a whitelist

StripHtml ( string source ) : string

Takes a raw source and removes all HTML tags

Private Methods

Method Description
CleanChildren ( HtmlNode parent, string whitelist ) : void

Apply CleanNodes to each of the child nodes

CleanNodes ( HtmlNode node, string whitelist ) : void

Recursively delete nodes not in the whitelist

GetHtml ( string source ) : HtmlAgilityPack.HtmlDocument

Helper function that returns an HTML document from text

Method Details

SanitizeHtml() public static method

Takes raw HTML input and cleans against a whitelist
public static SanitizeHtml ( string source ) : string
source string Html source
return string

StripHtml() public static method

Takes a raw source and removes all HTML tags
public static StripHtml ( string source ) : string
source string
return string