Table of Contents

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 HtmlTokenType

The type of the tag token.

position TextPosition

The 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 HtmlTokenType

The type of the tag token.

position TextPosition

The token's position.

name string

The name of the tag.

Properties

Attributes

Gets the list of attributes.

public List<HtmlAttributeToken> Attributes { get; }

Property Value

List<HtmlAttributeToken>

IsSelfClosing

Gets or sets the state of the self-closing flag.

public bool IsSelfClosing { get; set; }

Property Value

bool

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 string

The name of the attribute.

position TextPosition

The 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

name string

The name of the attribute.

value string

The value of the attribute.

Close(string)

Creates a new closing HtmlTagToken for the given name.

public static HtmlTagToken Close(string name)

Parameters

name string

The 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 string

The 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 string

The 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 string

The value to set.