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
Afficher le fichier Open project: LuccaSA/NExtends

Méthodes publiques

Méthode 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

Méthode 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 méthode

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

StripHtml() public static méthode

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