Text Navigation classes

Text Navigation API contains classes for browsing and editing text document structures and nodes. API also includes support for data filters.

Class TextPathNavigator


public class TextPathNavigator : ICloneable

Provides a cursor model for browsing and editing text data.
Constructor Parameters Description
TextPathNavigator TextNode node Creates a navigator attached to the node.
Property Type Description
HasChildren bool, get only Returns HasChildNodes of the underlying node.
SchemaInfo ITextSchemaInfo, get only Returns SchemaInfo of the underlying node.
UnderlyingObject TextNode, get only Returns the underlying node.
Method Parameters Description
AppendChild TextPathNavigator nav, returns void Append a new child to the list of child nodes of the current node.
PrependChild TextPathNavigator nav, returns void Inserts a new child into the beginning of the list of child nodes of the current node.
InsertBefore TextPathNavigator nav, returns void Inserts a new child to the parent's list of child nodes before current node.
InsertAfter TextPathNavigator nav, returns void Inserts a new child to the parent's list of child nodes after current node.
ReplaceSelf TextPathNavigator nav, returns void Replace current node with a new node in the parent's list of nodes and move navigator to a new node.
DeleteSelf returns void Delete current node from the parent's list of nodes and move navigator to a parent node.
DeleteRange TextPathNavigator end, returns void Delete a range of nodes from current node to the end node inclusively from the parent's list of nodes and move navigator to a parent node.
IsDescendant TextPathNavigator nav, returns bool Returns true if node representing by a given navigator is a descendant of current node.
IsAncestor TextPathNavigator nav, returns bool Returns true if node representing by a given navigator is an ancestor of current node.
IsSamePosition TextPathNavigator nav, returns bool Returns true if a given navigator represents the same node as a current one.
ComparePosition TextPathNavigator nav, returns NodeOrder Returns a sign of relative position of specified navigator against current one.
static Preceding TextNode node, returns TextNode Returns a preceding node for the given node.
static Following TextNode node, returns TextNode Returns a following node for the given node.
static Ancestor TextNode node, returns TextNode Returns a nearest ancestor node (parent) for the given node.
Descendant TextNode node, returns TextNode Returns a next descendant of current node after given node.
MoveTo TextPathNavigator nav, returns bool Position navigator to a node referenced by the specifies navigator. Returns true on success. Fails if two nodes belong to different documents.
MoveToFirst returns bool Moves navigator to the first sibling node. Returns true on success. Fails if parent node is null.
MoveToFirstChild returns bool Moves navigator to the first child node of the current node. Returns true on success. Fails if current node has no children.
MoveToFollowing returns bool Moves navigator to the following node in document. Returns true on success. Fails if current node is a last node in document.
MoveToFollowing TextPathNavigator nav, returns bool Moves navigator to the following node from the specified node. Returns true on success. Fails if given node is a last node in document.
MoveToPreceding returns bool Moves navigator to the preceding node in document. Returns true on success. Fails if current node is a first node in document.
MoveToNext returns bool Moves navigator to the next sibling node. Returns true on success. Fails if current node is the last.
MoveToParent returns bool Moves navigator to the parent node of a current node. Returns true on success. Fails if current node has no parent.
MoveToPrevious returns bool Moves navigator to the previous sibling node. Returns true on success. Fails if current node is the first.
MoveToRoot returns void Moves navigator to the root node of a document.
SelectAncestors TextPathNodeType type, bool MatchSelf, returns TextPathNodeIterator Selects all the ancestor nodes of the current node that match the selection criteria - type of nodes to be included into result set. If MatchSelf is specified and set to true, result will include the current node itself.
SelectDescendants TextPathNodeType type, bool MatchSelf, returns TextPathNodeIterator Selects all the descendant nodes of the current node that match the selection criteria - type of nodes to be included into the result set. If MatchSelf is specified (true), result will include the current node too.
SelectChildren TextPathNodeType type, returns TextPathNodeIterator Selects all the child nodes of the current node that match the selection criteria - type of nodes to be included into result set.

Class TextPathNodeIterator


public class TextPathNodeIterator : ICloneable, IEnumerable

Provides an iterator over selected set of nodes. Similar to XPathNodeIterator class in XMLDOM XPath.
Keeps internal position in the enumeration. Initial index value is -1. To start enumerating, you should call MoveNext().
Constructor Parameters Description
TextPathNodeIterator None Default constructor. Creates an empty iterator.
TextPathNodeIterator TextPathNodeIterator Copy constructor.
Property Type Description
List TextNodeList, get only Returns internal list of nodes.
Count long, get only Returns number of nodes in the list.
Current TextPathNavigator, get only Returns navigator referenced to the current node.
CurrentPosition long, get only Returns current position of the iterator.
Item (indexer) long, get/set Provides random access to nodes in the list. Does not affect current position.
Method Parameters Description
Add TextNode node, returns void Appends a new node to the list of nodes.
AddUnique TextNode node, returns void Appends a new node to the list of nodes if this list does not contain the node yet.
MoveNext Returns bool Advances current position. Returns true on success. Fails (i.e., returns false) if current node is the last one.
Reset Returns void Sets current position to -1.

Interface ITextNavigable


public interface ITextNavigable

Provides an accessor to class TextPathNavigator.
Method Parameters Description
CreateNavigator returns TextPathNavigator Returns a TextPathNavigator object for the current object (TextNode).

Enumeration TextPathNodeType


public enum TextPathNodeType

Represents type of nodes for selection operations.
Member Description
ALL Any node.
VALUE TextChar and TextString node.
RULE TextRule and TextDocument node.
ROOT Root node (which has no parent node).

See also: