HtmlMetaElement
sealed class HtmlMetaElement : HtmlElement, IHtmlMetaElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, 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, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
{
public string Content {
get {
return GetOwnAttribute(AttributeNames.Content);
}
set {
SetOwnAttribute(AttributeNames.Content, value);
}
}
public string Charset {
get {
return GetOwnAttribute(AttributeNames.Charset);
}
set {
SetOwnAttribute(AttributeNames.Charset, value);
}
}
public string HttpEquivalent {
get {
return GetOwnAttribute(AttributeNames.HttpEquiv);
}
set {
SetOwnAttribute(AttributeNames.HttpEquiv, value);
}
}
public string Scheme {
get {
return GetOwnAttribute(AttributeNames.Scheme);
}
set {
SetOwnAttribute(AttributeNames.Scheme, value);
}
}
public string Name {
get {
return GetOwnAttribute(AttributeNames.Name);
}
set {
SetOwnAttribute(AttributeNames.Name, value);
}
}
public HtmlMetaElement(Document owner, string prefix = null)
: base(owner, Tags.Meta, prefix, NodeFlags.SelfClosing | NodeFlags.Special)
{
}
public Encoding GetEncoding()
{
string charset = Charset;
if (charset != null) {
charset = charset.Trim();
if (TextEncoding.IsSupported(charset))
return TextEncoding.Resolve(charset);
}
if (!(HttpEquivalent?.Equals(HeaderNames.ContentType, StringComparison.OrdinalIgnoreCase) ?? false))
return null;
return TextEncoding.Parse(Content ?? string.Empty);
}
}
}