Class DocumentFragment

Class DocumentFragment

Namespace: Aspose.Html.Dom
Assembly: Aspose.HTML.dll (25.2.0)

DocumentFragment is a “lightweight” or “minimal” Document object. It is very common to want to be able to extract a portion of a document’s tree or to create a new fragment of a document.

[DOMName("DocumentFragment")]
[ComVisible(true)]
[DOMObject]
public class DocumentFragment : Node, INotifyPropertyChanged, IEventTarget, IDisposable, IXPathNSResolver, IParentNode, IElementTraversal

Inheritance

objectDOMObjectEventTargetNodeDocumentFragment

Derived

ShadowRoot

Implements

INotifyPropertyChanged, IEventTarget, IDisposable, IXPathNSResolver, IParentNode, IElementTraversal

Inherited Members

Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE, Node.TEXT_NODE, Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE, Node.ENTITY_NODE, Node.PROCESSING_INSTRUCTION_NODE, Node.COMMENT_NODE, Node.DOCUMENT_NODE, Node.DOCUMENT_TYPE_NODE, Node.DOCUMENT_FRAGMENT_NODE, Node.NOTATION_NODE, Node.HasChildNodes(), Node.Normalize(), Node.CloneNode(), Node.CloneNode(bool), Node.IsEqualNode(Node), Node.IsSameNode(Node), Node.LookupPrefix(string), Node.LookupNamespaceURI(string), Node.IsDefaultNamespace(string), Node.InsertBefore(Node, Node), Node.ReplaceChild(Node, Node), Node.RemoveChild(Node), Node.AppendChild(Node), Node.Dispose(bool), Node.ToString(), Node.NodeType, Node.LocalName, Node.NamespaceURI, Node.Prefix, Node.NodeName, Node.BaseURI, Node.OwnerDocument, Node.ParentNode, Node.ParentElement, Node.ChildNodes, Node.FirstChild, Node.LastChild, Node.PreviousSibling, Node.NextSibling, Node.NodeValue, Node.TextContent, EventTarget.AddEventListener(string, DOMEventHandler, bool), EventTarget.AddEventListener(string, IEventListener), EventTarget.AddEventListener(string, IEventListener, bool), EventTarget.RemoveEventListener(string, DOMEventHandler, bool), EventTarget.RemoveEventListener(string, IEventListener), EventTarget.RemoveEventListener(string, IEventListener, bool), EventTarget.DispatchEvent(Event), EventTarget.Dispose(), EventTarget.Dispose(bool), DOMObject.GetPlatformType(), object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Properties

ChildElementCount

Returns the current number of element nodes that are children of this element. 0 if this element has no child nodes that are of nodeType 1.

public int ChildElementCount { get; }

Property Value

int

Children

Returns the child elements of current element.

public HTMLCollection Children { get; }

Property Value

HTMLCollection

FirstElementChild

Returns the first child element node of this element. null if this element has no child elements.

public Element FirstElementChild { get; }

Property Value

Element

InnerHTML

Returns a fragment of HTML or XML that represents the element’s contents. Can be set, to replace the contents of the element with nodes parsed from the given string.

public string InnerHTML { get; set; }

Property Value

string

LastElementChild

Returns the last child element node of this element. null if this element has no child elements.

public Element LastElementChild { get; }

Property Value

Element

NextElementSibling

Returns the next sibling element node of this element. null if this element has no element sibling nodes that come after this one in the document tree.

public Element NextElementSibling { get; }

Property Value

Element

NodeName

The name of this node, depending on its type.

public override string NodeName { get; }

Property Value

string

NodeType

A code representing the type of the underlying object.

public override ushort NodeType { get; }

Property Value

ushort

OuterHTML

Returns a fragment of HTML or XML that represents the element and its contents. Can be set, to replace the element with nodes parsed from the given string.

public string OuterHTML { get; set; }

Property Value

string

PreviousElementSibling

Returns the previous sibling element node of this element. null if this element has no element sibling nodes that come before this one in the document tree.

public Element PreviousElementSibling { get; }

Property Value

Element

TextContent

This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to.

public override string TextContent { get; set; }

Property Value

string

Methods

QuerySelector(string)

Returns the first Element in document, which match selector

public Element QuerySelector(string selector)

Parameters

selector string

The selector.

Returns

Element

The matched element

QuerySelectorAll(string)

Returns a NodeList of all the Elements in document, which match selector

public NodeList QuerySelectorAll(string selector)

Parameters

selector string

The selector

Returns

NodeList

Aspose.Html.Collections.HTMLCollection