Class ElementFragment
Represents a HTML element.
Inherited Members
Namespace: EPiServer.HtmlParsing
Assembly: EPiServer.Framework.dll
Version: 11.20.7Syntax
public class ElementFragment : TokenFragmentBase<ElementToken>
Constructors
ElementFragment()
Initializes a new instance of the ElementFragment class.
Declaration
public ElementFragment()
Properties
Attributes
Gets the attributes for this HTML element.
Declaration
public AttributeCollection Attributes { get; }
Property Value
Type | Description |
---|---|
AttributeCollection | The attributes. |
CallbackOnEndElement
Gets or sets the callback to perform when a matching End element is found.
Declaration
public Action CallbackOnEndElement { get; set; }
Property Value
Type | Description |
---|---|
System.Action | The System.Action callback to perform. |
Remarks
By setting this property to an Action when a ElementFragment is returned by the enumerator, the Action will be invoked when the matching EndElementFragment is returned.
Important! This setting is mirrored by the CallbackOnEndElement property on HtmlStreamReader, but it is recommended to use the property on ElementFragment since it is much more consistent with the data flow.
HasAttributes
Gets a value indicating whether this instance has attributes.
Declaration
public bool HasAttributes { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
Parse(IHtmlParserContext)
Parses a HTML element.
Declaration
public override void Parse(IHtmlParserContext context)
Parameters
Type | Name | Description |
---|---|---|
IHtmlParserContext | context | The context. |
Overrides
Remarks
The initial '<' has already been consumed and parsing continues until the entire element has been properly parsed.
ToWriter(TextWriter)
Outputs this HTML element to the writer.
Declaration
public override void ToWriter(TextWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextWriter | writer | The writer. |