Class HtmlTagToken
- Namespace
- AngleSharp.Html.Parser.Tokens
- Assembly
- AngleSharp.dll
Class for StartTagToken and EndTagToken.
public sealed class HtmlTagToken : HtmlToken, ISourceReference
- Inheritance
-
HtmlTagToken
- Implements
- Inherited Members
- Extension Methods
Constructors
HtmlTagToken(HtmlTokenType, TextPosition)
Sets the default values.
public HtmlTagToken(HtmlTokenType type, TextPosition position)
Parameters
type
HtmlTokenTypeThe type of the tag token.
position
TextPositionThe token's position.
HtmlTagToken(HtmlTokenType, TextPosition, string)
Creates a new HTML TagToken with the defined name.
public HtmlTagToken(HtmlTokenType type, TextPosition position, string name)
Parameters
type
HtmlTokenTypeThe type of the tag token.
position
TextPositionThe token's position.
name
stringThe name of the tag.
Properties
Attributes
Gets the list of attributes.
public List<HtmlAttributeToken> Attributes { get; }
Property Value
IsSelfClosing
Gets or sets the state of the self-closing flag.
public bool IsSelfClosing { get; set; }
Property Value
Methods
AddAttribute(string, TextPosition)
Adds a new attribute to the list of attributes. The value will be set to an empty string.
public void AddAttribute(string name, TextPosition position)
Parameters
name
stringThe name of the attribute.
position
TextPositionThe starting position of the attribute.
AddAttribute(string, string)
Adds a new attribute to the list of attributes.
public void AddAttribute(string name, string value)
Parameters
Close(string)
Creates a new closing HtmlTagToken for the given name.
public static HtmlTagToken Close(string name)
Parameters
name
stringThe name of the tag.
Returns
- HtmlTagToken
The new HTML tag token.
GetAttribute(string)
Gets the value of the attribute with the given name or an empty string if the attribute is not available.
public string GetAttribute(string name)
Parameters
name
stringThe name of the attribute.
Returns
- string
The value of the attribute.
Open(string)
Creates a new opening HtmlTagToken for the given name.
public static HtmlTagToken Open(string name)
Parameters
name
stringThe name of the tag.
Returns
- HtmlTagToken
The new HTML tag token.
SetAttributeValue(string)
Sets the value of the last added attribute.
public void SetAttributeValue(string value)
Parameters
value
stringThe value to set.