Skip to main content

HtmlTagAttributes Struct

Definition

Assembly:Avalonia.Controls.Documents.Serialization.Html
Package:Avalonia.Controls.Documents.Serialization.Html

The attributes of a single HTML tag, handed to an Avalonia.Controls.Documents.Serialization.Html.IHtmlTagHandler.

public struct HtmlTagAttributes

Inheritance: ValueType -> HtmlTagAttributes

Remarks

Names and values are spans into the tag text the tokenizer is currently holding, so reading them allocates nothing. The spans are only valid for the duration of the handler callback; call ReadOnlySpan<T>.ToString on anything that has to outlive it.

Methods

NameDescription
GetNameGets the name of the attribute at index, in the casing the document used.
GetValueGets the value of the attribute at index with the surrounding quotes stripped. Empty for a boolean attribute such as disabled.
TryGetValueNo summary available.

GetName Method

Gets the name of the attribute at index, in the casing the document used.

public ReadOnlySpan<char> GetName(int index)

Parameters

index int

The zero-based attribute index.

Returns

ReadOnlySpan<char>

Exceptions

GetValue Method

Gets the value of the attribute at index with the surrounding quotes stripped. Empty for a boolean attribute such as disabled.

public ReadOnlySpan<char> GetValue(int index)

Parameters

index int

The zero-based attribute index.

Returns

ReadOnlySpan<char>

Exceptions

TryGetValue Method

public bool TryGetValue(ReadOnlySpan<char> name, ReadOnlySpan<char>& value)

Parameters

name ReadOnlySpan<char>

value ReadOnlySpan<char>&

Returns

bool

Properties

NameDescription
CountGets the number of attributes on the tag.

Count Property

Gets the number of attributes on the tag.

public int Count { get; set; }