aspose.html.dom.traversal

The Aspose.Html.Dom.Traversal namespace contains methods that create iterators and tree-walkers to navigate between elements and traverse a node and its children in document order.

Classes

ClassDescription
IDocumentTraversalDocumentTraversal contains methods that create iterators and
tree-walkers to traverse a node and its children in document order (depth
first, pre-order traversal, which is equivalent to the order in which the
start tags occur in the text representation of the document). In DOMs
which support the Traversal feature, DocumentTraversal will
be implemented by the same objects that implement the Document interface.

See also the Document object Model (DOM) Level 2 Traversal and Range Specification.
@since DOM Level 2
IElementTraversalThe ElementTraversal interface is a set of read-only attributes which allow an author to easily navigate between elements in a document. In conforming implementations of Element Traversal, all objects that implement Element must also implement the ElementTraversal interface.
INodeFilterFilters are objects that know how to “filter out” nodes. If a
NodeIterator or TreeWalker is given a
NodeFilter, it applies the filter before it returns the next
node. If the filter says to accept the node, the traversal logic returns
it; otherwise, traversal looks for the next node and pretends that the
node that was rejected was not there.

The DOM does not provide any filters. NodeFilter is just an
interface that users can implement to provide their own filters.



NodeFilters do not need to know how to traverse from node
to node, nor do they need to know anything about the data structure that
is being traversed. This makes it very easy to write filters, since the
only thing they have to know how to do is evaluate a single node. One
filter may be used with a number of different kinds of traversals,
encouraging code reuse.



See also the Document object Model (DOM) Level 2 Traversal and Range Specification.
@since DOM Level 2
INodeIteratorIterators are used to step through a set of nodes, e.g. the
set of nodes in a NodeList, the document subtree governed by
a particular Node, the results of a query, or any other set
of nodes. The set of nodes to be iterated is determined by the
implementation of the NodeIterator. DOM Level 2 specifies a
single NodeIterator implementation for document-order
traversal of a document subtree. Instances of these iterators are created
by calling DocumentTraversal
.createNodeIterator().

See also the Document object Model (DOM) Level 2 Traversal and Range Specification.
@since DOM Level 2
ITraversalIterators are used to step through a set of nodes, e.g. the
set of nodes in a NodeList, the document subtree governed by
a particular Node, the results of a query, or any other set
of nodes. The set of nodes to be iterated is determined by the
implementation of the NodeIterator. DOM Level 2 specifies a
single NodeIterator implementation for document-order
traversal of a document subtree. Instances of these iterators are created
by calling DocumentTraversal
.createNodeIterator().

See also the Document object Model (DOM) Level 2 Traversal and Range Specification.
@since DOM Level 2
ITreeWalkerTreeWalker objects are used to navigate a document tree or
subtree using the view of the document defined by their
whatToShow flags and filter (if any). Any function which
performs navigation using a TreeWalker will automatically
support any view defined by a TreeWalker.

Omitting nodes from the logical view of a subtree can result in a
structure that is substantially different from the same subtree in the
complete, unfiltered document. Nodes that are siblings in the
TreeWalker view may be children of different, widely
separated nodes in the original view. For instance, consider a
NodeFilter that skips all nodes except for Text nodes and
the root node of a document. In the logical view that results, all text
nodes will be siblings and appear as direct children of the root node, no
matter how deeply nested the structure of the original document.



See also the Document object Model (DOM) Level 2 Traversal and Range Specification.
@since DOM Level 2