BinPath classes

BinPath classes are similar to the ones defined in System.Xml.XPath namespace for XML documents.
This API contains classes for browsing and editing binary document structures and nodes. API also includes support for queries and data filters.

Class BinPathNavigator


public class BinPathNavigator : ICloneable

Provides a cursor model for browsing and editing binary data.
Constructor Parameters Description
BinPathNavigator BinNode node Creates a navigator attached to the node.
Property Type Description
HasChildren bool, get only Returns HasChildNodes of the underlying node.
InnerBin BinStorage, get/set Access to InnerBin of the underlying node.
Name string, get only Returns name of the item in schema, if ShemaInfo is present and initialized. Otherwise, returns empty string.
NodeType BinNodeType, get only Returns NodeType of the underlying node.
SchemaInfo IBinSchemaInfo, get only Returns SchemaInfo of the underlying node.
UnderlyingObject BinNode, get only Returns the underlying node.
Method Parameters Description
AppendChild BinPathNavigator nav, returns void Append a new child to the list of child nodes of the current node.
PrependChild BinPathNavigator nav, returns void Inserts a new child into the beginning of the list of child nodes of the current node.
InsertBefore BinPathNavigator nav, returns void Inserts a new child to the parent's list of child nodes before current node.
InsertAfter BinPathNavigator nav, returns void Inserts a new child to the parent's list of child nodes after current node.
ReplaceSelf BinPathNavigator 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 BinPathNavigator 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 BinPathNavigator nav, returns bool Returns true if node representing by a given navigator is a descendant of current node.
IsAncestor BinPathNavigator nav, returns bool Returns true if node representing by a given navigator is an ancestor of current node.
IsSamePosition BinPathNavigator nav, returns bool Returns true if a given navigator represents the same node as a current one.
ComparePosition BinPathNavigator nav, returns NodeOrder Returns a sign of relative position of specified navigator against current one.
static Preceding BinNode node, returns BinNode Returns a preceding node for the given node.
static Following BinNode node, returns BinNode Returns a following node for the given node.
static Ancestor BinNode node, returns BinNode Returns a nearest ancestor node (parent) for the given node.
Descendant BinNode node, returns BinNode Returns a next descendant of current node after given node.
MoveTo BinPathNavigator 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 BinPathNavigator 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 BinPathNodeType type, bool MatchSelf, returns BinPathNodeIterator 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 BinPathNodeType type, bool MatchSelf, returns BinPathNodeIterator 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 BinPathNodeType type, returns BinPathNodeIterator Selects all the child nodes of the current node that match the selection criteria - type of nodes to be included into result set.
Compile string formula, returns BinPathExpression Compiles a BinPath expression, checks it for validity in the context of current node and returns compiled expression.
CompileOnly string formula, returns BinPathExpression Compiles a BinPath expression and returns compiled expression.
Evaluate string formula, returns Object Executes an expression in the context of current node and returns the result of execution. It will return BinNode-derived object if one or more (BinNodeCollection) nodes selected, or Variant if immediated value shall be returned (if result is just a number or string) - BinValueCalculated will be "dereferenced" to Variant value.
Evaluate BinPathExpression expr, returns Object The same as above, but with pre-compiled expression.
Matches string formula, returns bool Executes an expression in the context of current node and returns true if result of the execution is the same node as the current one.
Matches BinPathExpression expr, returns bool Same as above, but with pre-compiled expression.
Select string formula, returns BinPathNodeIterator Executes an expression in the context of current node and returns a collection of nodes. If expression calculation result is a single node, collection will be created anyways and resulting node will be inserted into this collection.
Select BinPathExpression expr, returns BinPathNodeIterator Same as above, but with pre-compiled expression.
SelectSingleNode string formula, returns BinPathNavigator Executes an expression in the context of current node and returns a navigator representing resulting node. This could be a single node from the document (BinNode-derived object), collection of nodes or immediate value (BinValueCalculated).
SelectSingleNode BinPathExpression expr, returns BinPathNavigator Same as above, but with pre-compiled expression.

Class BinPathNodeIterator


public class BinPathNodeIterator : 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
BinPathNodeIterator None Default constructor. Creates an empty iterator.
Property Type Description
List BinNodeList, get only Returns internal list of nodes.
Count long, get only Returns number of nodes in the list.
Current BinPathNavigator, 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 BinNode node, returns void Appends a new node to the list of nodes.
AddUnique BinNode 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.

Class BinPathExpression


public class BinPathExpression

Represents a compiled BinPath expression.
Constructor Parameters Description
BinPathExpression string formula Creates an expression which contains a formula. Expression is not yet ready to be used in calculation - it must be compiled first.
Property Type Description
Expression string, get only Returns an string representation of the expression.
Method Parameters Description
static Compile string formula, returns void Creates a BinPathExpression object, compiles formula and returns a ready-for-use expression.

Interface IBinNavigable


public interface IBinNavigable

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

Enumeration BinPathNodeType


public enum BinPathNodeType

Represents type of nodes for selection operations.
Member Description
ALL Any node.
VALUE BinValue and BinValueCalculated node.
VALUEARRAY BinValueArray node.
STRUCT BinStruct and BinDocument node.
ROOT Root node (which has no parent node).

See also: