HtmlMetaElement
sealed class HtmlMetaElement : HtmlElement, IHtmlMetaElement, IHtmlElement, IElement, INode, IEventTarget, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
Represents the HTML meta element.
using AngleSharp.Dom.Css;
using AngleSharp.Html;
using AngleSharp.Network;
using System;
using System.Text;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlMetaElement : HtmlElement, IHtmlMetaElement, IHtmlElement, IElement, INode, IEventTarget, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
{
public string Content {
get {
return GetAttribute(AttributeNames.Content);
}
set {
SetAttribute(AttributeNames.Content, value);
}
}
public string Charset {
get {
return GetAttribute(AttributeNames.Charset);
}
set {
SetAttribute(AttributeNames.Charset, value);
}
}
public string HttpEquivalent {
get {
return GetAttribute(AttributeNames.HttpEquiv);
}
set {
SetAttribute(AttributeNames.HttpEquiv, value);
}
}
public string Scheme {
get {
return GetAttribute(AttributeNames.Scheme);
}
set {
SetAttribute(AttributeNames.Scheme, value);
}
}
public string Name {
get {
return GetAttribute(AttributeNames.Name);
}
set {
SetAttribute(AttributeNames.Name, value);
}
}
public HtmlMetaElement(Document owner)
: base(owner, Tags.Meta, NodeFlags.SelfClosing | NodeFlags.Special)
{
}
public Encoding GetEncoding()
{
string charset = Charset;
if (charset != null && TextEncoding.IsSupported(charset))
return TextEncoding.Resolve(charset);
string httpEquivalent = HttpEquivalent;
if (httpEquivalent != null && httpEquivalent.Equals(HeaderNames.ContentType, StringComparison.OrdinalIgnoreCase))
return TextEncoding.Parse(Content ?? string.Empty);
return null;
}
}
}