Class HtmlEntity
- Namespace
- HtmlAgilityPack
- Assembly
- HtmlAgilityPack.dll
A utility class to replace special characters by entities and vice-versa. Follows HTML 4.0 specification found at http://www.w3.org/TR/html4/sgml/entities.html Follows Additional specification found at https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references See also: https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
public class HtmlEntity
- Inheritance
-
HtmlEntity
- Inherited Members
Properties
EntityName
A collection of entities indexed by name.
public static Dictionary<int, string> EntityName { get; }
Property Value
EntityValue
A collection of entities indexed by value.
public static Dictionary<string, int> EntityValue { get; }
Property Value
Methods
DeEntitize(string)
Replace known entities by characters.
public static string DeEntitize(string text)
Parameters
text
stringThe source text.
Returns
- string
The result text.
Entitize(HtmlNode)
Clone and entitize an HtmlNode. This will affect attribute values and nodes' text. It will also entitize all child nodes.
public static HtmlNode Entitize(HtmlNode node)
Parameters
node
HtmlNodeThe node to entitize.
Returns
- HtmlNode
An entitized cloned node.
Entitize(string)
Replace characters above 127 by entities.
public static string Entitize(string text)
Parameters
text
stringThe source text.
Returns
- string
The result text.
Entitize(string, bool)
Replace characters above 127 by entities.
public static string Entitize(string text, bool useNames)
Parameters
text
stringThe source text.
useNames
boolIf set to false, the function will not use known entities name. Default is true.
Returns
- string
The result text.
Entitize(string, bool, bool)
Replace characters above 127 by entities.
public static string Entitize(string text, bool useNames, bool entitizeQuotAmpAndLtGt)
Parameters
text
stringThe source text.
useNames
boolIf set to false, the function will not use known entities name. Default is true.
entitizeQuotAmpAndLtGt
boolIf set to true, the [quote], [ampersand], [lower than] and [greather than] characters will be entitized.
Returns
- string
The result text