Element Class |
Namespace: MailBee.Html
The Element type exposes the following members.
Name | Description | |
---|---|---|
Element | Initializes a new instance of the Element class | |
Element(String) |
Initializes a new instance of Element object with the specified HTML markup.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetAllElements |
Returns the current HTML element and all its child elements as a flat list.
| |
GetAllElementsByName |
Returns the current HTML element and all its child elements
having the specified tag name as a flat list.
| |
GetAttributeByName |
Returns the HTML attribute with the specified name.
| |
GetAttributesByName |
Returns all attributes with the specified name and contained in the current HTML element.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetInnerElementsByName |
Returns the flat list containing elements with the specified tag name and contained in the current HTML element.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Process |
Applies the specified tag processing rules to the current element and any its child elements, calling a delegate
for every tag which matches the specified rules.
| |
ProcessToString |
Applies the specified tag processing rules to the copy of the current element and any its child elements, calling a delegate
for every tag which matches the specified rules, and returns the resulting OuterHtml as a string.
| |
Remove |
Removes this HTML element from InnerElements collection of its parent.
| |
Stop |
Stops execution of Process(RuleSet, ProcessElementDelegate) and ProcessToString(RuleSet, ProcessElementDelegate) methods.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
Attributes |
Gets the list of all attributes of the HTML tag.
| |
InnerElements |
Gets the list of HTML elements directly contained in the current HTML element.
| |
InnerHtml |
Gets or sets the inner HTML contents of the current HTML element.
| |
OuterHtml |
Gets or sets the text representation of the current HTML element.
| |
TagDefinition |
Gets or sets the tag definition of the current HTML element.
| |
TagName |
Gets or sets the tag name of the current HTML element.
|
Objects of this class are building blocks of DOM (document object model) of the HTML document. MailBee represents the HTML document as a tree of Element objects which can be nested within each other accordingly the HTML markup of the document. The document itself is also represented as Element object.
Each Element object has InnerElements collection of HTML elements nested in the parent one. Alternatively, you can get the list of all elements located inside the parent element, regardless of their nesting level (not important if they are nested directly in the parent element or into any of its child elements). You can use GetAllElements, GetInnerElementsByName(String) and other methods for this.
You can also access various parts of the contents of the HTML element as a string using InnerHtml, OuterHtml, TagDefinition and TagName properties. For instance, you can set TagDefinition to a certain tag definition string and then use Attributes collection to examine the attibutes of this tag.
Use Process(RuleSet, ProcessElementDelegate) or ProcessToString(RuleSet, ProcessElementDelegate) methods for advanced processing of HTML documents. These methods allow the developer to apply a set of content-processing rules to the HTML document. These rules can be both user-defined and predefined (such as GetSafeHtmlRules which defines the rules for making HTML document contents safe and free from any potentially dangerous items such as scripts).
To get the list of links or images in the document represented by Element object, create Processor object and set Dom property to the given Element object reference, and examine AHRefs and Images property values. You can also use Processor class to read/write HTML markup from/into a stream.