HtmlTag

TheArtOfDev.HtmlRenderer.Core.Dom

Constructors

HtmlTag(string, bool, Dictionary<string, string>)

Init.

name
the name of the html tag
isSingle
if the tag is single placed; in other words it doesn't have a separate closing tag;
attributes
collection of attributes and their value the html tag has

Properties

Attributes : Dictionary<string, string>

Gets collection of attributes and their value the html tag has

IsSingle : bool

Gets if the tag is single placed; in other words it doesn't have a separate closing tag; e.g. <br>

Name : string

Gets the name of this tag

Methods

HasAttribute(string) : bool

Gets a boolean indicating if the attribute list has the specified attribute

attribute
attribute name to check if exists

Returns: true - attribute exists, false - otherwise

HasAttributes() : bool

is the html tag has attributes.

Returns: true - has attributes, false - otherwise

TryGetAttribute(string, string) : string

Get attribute value for given attribute name or null if not exists.

attribute
attribute name to get by
defaultValue
optional: value to return if attribute is not specified

Returns: attribute value or null if not found

Fields

_attributes : Dictionary<string, string>

collection of attributes and their value the html tag has

_isSingle : bool

if the tag is single placed; in other words it doesn't have a separate closing tag;

_name : string

the name of the html tag