Table of Contents

Interface ITreeWalker

Namespace
AngleSharp.Dom
Assembly
AngleSharp.dll

The TreeWalker object represents the nodes of a document subtree and a position within them.

[DomName("TreeWalker")]
public interface ITreeWalker
Extension Methods

Properties

Current

Gets or sets the Node on which the TreeWalker is currently pointing at.

[DomName("currentNode")]
INode Current { get; set; }

Property Value

INode

Filter

Gets the NodeFilter used to select the relevant nodes.

[DomName("filter")]
NodeFilter Filter { get; }

Property Value

NodeFilter

Root

Gets a Node representing the root node as specified when the TreeWalker was created.

[DomName("root")]
INode Root { get; }

Property Value

INode

Settings

Gets a description of the types of nodes that must to be presented. Non-matching nodes are skipped, but their children may be included, if relevant.

[DomName("whatToShow")]
FilterSettings Settings { get; }

Property Value

FilterSettings

Methods

ToFirst()

Moves the current Node to the first visible child of the current node, and returns the found child. It also moves the current node to this child. If no such child exists, returns null and the current node is not changed.

[DomName("firstChild")]
INode? ToFirst()

Returns

INode

ToLast()

Moves the current Node to the last visible child of the current node, and returns the found child. It also moves the current node to this child. If no such child exists, returns null and the current node is not changed.

[DomName("lastChild")]
INode? ToLast()

Returns

INode

ToNext()

Moves the current Node to the next visible node in the document order, and returns the found node. It also moves the current node to this one. If no such node exists, returns null and the current node is not changed.

[DomName("nextNode")]
INode? ToNext()

Returns

INode

The next Node, if any.

ToNextSibling()

Moves the current Node to its next sibling, if any, and returns the found sibling. I there is no such node, return null and the current node is not changed.

[DomName("nextSibling")]
INode? ToNextSibling()

Returns

INode

ToParent()

Moves the current Node to the first visible ancestor node in the document order, and returns the found node. It also moves the current node to this one. If no such node exists, or if it is before that the root node defined at the object construction, returns null and the current node is not changed.

[DomName("parentNode")]
INode? ToParent()

Returns

INode

ToPrevious()

Moves the current Node to the previous visible node in the document order, and returns the found node. It also moves the current node to this one. If no such node exists,or if it is before that the root node defined at the object construction, returns null and the current node is not changed.

[DomName("previousNode")]
INode? ToPrevious()

Returns

INode

The previous Node, if any.

ToPreviousSibling()

Moves the current Node to its previous sibling, if any, and returns the found sibling. I there is no such node, return null and the current node is not changed.

[DomName("previousSibling")]
INode? ToPreviousSibling()

Returns

INode