C# Class MS.Internal.Xml.Cache.XPathNodeHelper

Library of XPathNode helper routines.
Show file Open project: gbarnett/shared-source-cli-2.0 Class Usage Examples

Public Methods

Method Description
GetAttribute ( XPathNode &pageNode, int &idxNode, string localName, string namespaceName ) : bool

Return the attribute of the specified node that has the specified name. If no such attribute exists, then do not set pageNode or idxNode and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.

GetContentChild ( XPathNode &pageNode, int &idxNode ) : bool

Return the first content-typed child of the specified node. If the node has no children, or if the node is not content-typed, then do not set pageNode or idxNode and return false.

GetContentChild ( XPathNode &pageNode, int &idxNode, XPathNodeType typ ) : bool

Return the first child of the specified node that has the specified type (must be a content type). If no such child exists, then do not set pageNode or idxNode and return false.

GetContentFollowing ( XPathNode &pageCurrent, int &idxCurrent, XPathNode pageEnd, int idxEnd, XPathNodeType typ ) : bool

Get the next node that: 1. Follows the current node in document order (includes descendants, unlike XPath following axis) 2. Precedes the ending node in document order (if pageEnd is null, then all following nodes in the document are considered) 3. Has the specified XPathNodeType (but Attributes and Namespaces never match) If no such node exists, then do not set pageCurrent or idxCurrent and return false.

GetContentSibling ( XPathNode &pageNode, int &idxNode ) : bool

Return the next content-typed sibling of the specified node. If the node has no siblings, or if the node is not content-typed, then do not set pageNode or idxNode and return false.

GetContentSibling ( XPathNode &pageNode, int &idxNode, XPathNodeType typ ) : bool

Return a following sibling of the specified node that has the specified type. If no such sibling exists, then do not set pageNode or idxNode and return false.

GetElementChild ( XPathNode &pageNode, int &idxNode, string localName, string namespaceName ) : bool

Return the first element child of the specified node that has the specified name. If no such child exists, then do not set pageNode or idxNode and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.

GetElementFollowing ( XPathNode &pageCurrent, int &idxCurrent, XPathNode pageEnd, int idxEnd, string localName, string namespaceName ) : bool

Get the next element node that: 1. Follows the current node in document order (includes descendants, unlike XPath following axis) 2. Precedes the ending node in document order (if pageEnd is null, then all following nodes in the document are considered) 3. Has the specified QName If no such element exists, then do not set pageCurrent or idxCurrent and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.

GetElementSibling ( XPathNode &pageNode, int &idxNode, string localName, string namespaceName ) : bool

Return a following sibling element of the specified node that has the specified name. If no such sibling exists, or if the node is not content-typed, then do not set pageNode or idxNode and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.

GetFirstAttribute ( XPathNode &pageNode, int &idxNode ) : bool

Return the first attribute of the specified node. If no attribute exist, do not set pageNode or idxNode and return false.

GetFollowing ( XPathNode &pageNode, int &idxNode ) : bool

Get the next non-virtual (not collapsed text, not namespaces) node that follows the specified node in document order. If no such node exists, then do not set pageNode or idxNode and return false.

GetInScopeNamespaces ( XPathNode pageElem, int idxElem, XPathNode &pageNmsp ) : int

Return chain of in-scope namespace nodes for nodes of type Element. Nodes in the chain might not have this element as their parent. Since the xmlns:xml namespace node is always in scope, this method will never return 0 if the specified node is an element.

GetLocalNamespaces ( XPathNode pageElem, int idxElem, XPathNode &pageNmsp ) : int

Return chain of namespace nodes. If specified node has no local namespaces, then 0 will be returned. Otherwise, the first node in the chain is guaranteed to be a local namespace (its parent is this node). Subsequent nodes may not have the same node as parent, so the caller will need to test the parent in order to terminate a search that processes only local namespaces.

GetLocation ( XPathNode pageNode, int idxNode ) : int

Return a location integer that can be easily compared with other locations from the same document in order to determine the relative document order of two nodes.

GetNextAttribute ( XPathNode &pageNode, int &idxNode ) : bool

Return the next attribute sibling of the specified node. If the node is not itself an attribute, or if there are no siblings, then do not set pageNode or idxNode and return false.

GetNonDescendant ( XPathNode &pageNode, int &idxNode ) : bool

Get the next non-virtual (not collapsed text, not namespaces) node that follows the specified node in document order, but is not a descendant. If no such node exists, then do not set pageNode or idxNode and return false.

GetParent ( XPathNode &pageNode, int &idxNode ) : bool

Return the parent of the specified node. If the node has no parent, do not set pageNode or idxNode and return false.

GetPreviousContentSibling ( XPathNode &pageNode, int &idxNode ) : bool

Return the first preceding sibling of the specified node. If no such sibling exists, then do not set pageNode or idxNode and return false.

GetPreviousContentSibling ( XPathNode &pageNode, int &idxNode, XPathNodeType typ ) : bool

Return a previous sibling of the specified node that has the specified type. If no such sibling exists, then do not set pageNode or idxNode and return false.

GetPreviousElementSibling ( XPathNode &pageNode, int &idxNode, string localName, string namespaceName ) : bool

Return a previous sibling element of the specified node that has the specified name. If no such sibling exists, or if the node is not content-typed, then do not set pageNode or idxNode and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.

GetTextFollowing ( XPathNode &pageCurrent, int &idxCurrent, XPathNode pageEnd, int idxEnd ) : bool

Scan all nodes that follow the current node in document order, but precede the ending node in document order. Return two types of nodes with non-null text: 1. Element parents of collapsed text nodes (since it is the element parent that has the collapsed text) 2. Non-collapsed text nodes If no such node exists, then do not set pageCurrent or idxCurrent and return false.

Private Methods

Method Description
GetChild ( XPathNode &pageNode, int &idxNode ) : void

Return the page and index of the first child (attribute or content) of the specified node.

Method Details

GetAttribute() public static method

Return the attribute of the specified node that has the specified name. If no such attribute exists, then do not set pageNode or idxNode and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.
public static GetAttribute ( XPathNode &pageNode, int &idxNode, string localName, string namespaceName ) : bool
pageNode XPathNode
idxNode int
localName string
namespaceName string
return bool

GetContentChild() public static method

Return the first content-typed child of the specified node. If the node has no children, or if the node is not content-typed, then do not set pageNode or idxNode and return false.
public static GetContentChild ( XPathNode &pageNode, int &idxNode ) : bool
pageNode XPathNode
idxNode int
return bool

GetContentChild() public static method

Return the first child of the specified node that has the specified type (must be a content type). If no such child exists, then do not set pageNode or idxNode and return false.
public static GetContentChild ( XPathNode &pageNode, int &idxNode, XPathNodeType typ ) : bool
pageNode XPathNode
idxNode int
typ XPathNodeType
return bool

GetContentFollowing() public static method

Get the next node that: 1. Follows the current node in document order (includes descendants, unlike XPath following axis) 2. Precedes the ending node in document order (if pageEnd is null, then all following nodes in the document are considered) 3. Has the specified XPathNodeType (but Attributes and Namespaces never match) If no such node exists, then do not set pageCurrent or idxCurrent and return false.
public static GetContentFollowing ( XPathNode &pageCurrent, int &idxCurrent, XPathNode pageEnd, int idxEnd, XPathNodeType typ ) : bool
pageCurrent XPathNode
idxCurrent int
pageEnd XPathNode
idxEnd int
typ XPathNodeType
return bool

GetContentSibling() public static method

Return the next content-typed sibling of the specified node. If the node has no siblings, or if the node is not content-typed, then do not set pageNode or idxNode and return false.
public static GetContentSibling ( XPathNode &pageNode, int &idxNode ) : bool
pageNode XPathNode
idxNode int
return bool

GetContentSibling() public static method

Return a following sibling of the specified node that has the specified type. If no such sibling exists, then do not set pageNode or idxNode and return false.
public static GetContentSibling ( XPathNode &pageNode, int &idxNode, XPathNodeType typ ) : bool
pageNode XPathNode
idxNode int
typ XPathNodeType
return bool

GetElementChild() public static method

Return the first element child of the specified node that has the specified name. If no such child exists, then do not set pageNode or idxNode and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.
public static GetElementChild ( XPathNode &pageNode, int &idxNode, string localName, string namespaceName ) : bool
pageNode XPathNode
idxNode int
localName string
namespaceName string
return bool

GetElementFollowing() public static method

Get the next element node that: 1. Follows the current node in document order (includes descendants, unlike XPath following axis) 2. Precedes the ending node in document order (if pageEnd is null, then all following nodes in the document are considered) 3. Has the specified QName If no such element exists, then do not set pageCurrent or idxCurrent and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.
public static GetElementFollowing ( XPathNode &pageCurrent, int &idxCurrent, XPathNode pageEnd, int idxEnd, string localName, string namespaceName ) : bool
pageCurrent XPathNode
idxCurrent int
pageEnd XPathNode
idxEnd int
localName string
namespaceName string
return bool

GetElementSibling() public static method

Return a following sibling element of the specified node that has the specified name. If no such sibling exists, or if the node is not content-typed, then do not set pageNode or idxNode and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.
public static GetElementSibling ( XPathNode &pageNode, int &idxNode, string localName, string namespaceName ) : bool
pageNode XPathNode
idxNode int
localName string
namespaceName string
return bool

GetFirstAttribute() public static method

Return the first attribute of the specified node. If no attribute exist, do not set pageNode or idxNode and return false.
public static GetFirstAttribute ( XPathNode &pageNode, int &idxNode ) : bool
pageNode XPathNode
idxNode int
return bool

GetFollowing() public static method

Get the next non-virtual (not collapsed text, not namespaces) node that follows the specified node in document order. If no such node exists, then do not set pageNode or idxNode and return false.
public static GetFollowing ( XPathNode &pageNode, int &idxNode ) : bool
pageNode XPathNode
idxNode int
return bool

GetInScopeNamespaces() public static method

Return chain of in-scope namespace nodes for nodes of type Element. Nodes in the chain might not have this element as their parent. Since the xmlns:xml namespace node is always in scope, this method will never return 0 if the specified node is an element.
public static GetInScopeNamespaces ( XPathNode pageElem, int idxElem, XPathNode &pageNmsp ) : int
pageElem XPathNode
idxElem int
pageNmsp XPathNode
return int

GetLocalNamespaces() public static method

Return chain of namespace nodes. If specified node has no local namespaces, then 0 will be returned. Otherwise, the first node in the chain is guaranteed to be a local namespace (its parent is this node). Subsequent nodes may not have the same node as parent, so the caller will need to test the parent in order to terminate a search that processes only local namespaces.
public static GetLocalNamespaces ( XPathNode pageElem, int idxElem, XPathNode &pageNmsp ) : int
pageElem XPathNode
idxElem int
pageNmsp XPathNode
return int

GetLocation() public static method

Return a location integer that can be easily compared with other locations from the same document in order to determine the relative document order of two nodes.
public static GetLocation ( XPathNode pageNode, int idxNode ) : int
pageNode XPathNode
idxNode int
return int

GetNextAttribute() public static method

Return the next attribute sibling of the specified node. If the node is not itself an attribute, or if there are no siblings, then do not set pageNode or idxNode and return false.
public static GetNextAttribute ( XPathNode &pageNode, int &idxNode ) : bool
pageNode XPathNode
idxNode int
return bool

GetNonDescendant() public static method

Get the next non-virtual (not collapsed text, not namespaces) node that follows the specified node in document order, but is not a descendant. If no such node exists, then do not set pageNode or idxNode and return false.
public static GetNonDescendant ( XPathNode &pageNode, int &idxNode ) : bool
pageNode XPathNode
idxNode int
return bool

GetParent() public static method

Return the parent of the specified node. If the node has no parent, do not set pageNode or idxNode and return false.
public static GetParent ( XPathNode &pageNode, int &idxNode ) : bool
pageNode XPathNode
idxNode int
return bool

GetPreviousContentSibling() public static method

Return the first preceding sibling of the specified node. If no such sibling exists, then do not set pageNode or idxNode and return false.
public static GetPreviousContentSibling ( XPathNode &pageNode, int &idxNode ) : bool
pageNode XPathNode
idxNode int
return bool

GetPreviousContentSibling() public static method

Return a previous sibling of the specified node that has the specified type. If no such sibling exists, then do not set pageNode or idxNode and return false.
public static GetPreviousContentSibling ( XPathNode &pageNode, int &idxNode, XPathNodeType typ ) : bool
pageNode XPathNode
idxNode int
typ XPathNodeType
return bool

GetPreviousElementSibling() public static method

Return a previous sibling element of the specified node that has the specified name. If no such sibling exists, or if the node is not content-typed, then do not set pageNode or idxNode and return false. Assume that the localName has been atomized with respect to this document's name table, but not the namespaceName.
public static GetPreviousElementSibling ( XPathNode &pageNode, int &idxNode, string localName, string namespaceName ) : bool
pageNode XPathNode
idxNode int
localName string
namespaceName string
return bool

GetTextFollowing() public static method

Scan all nodes that follow the current node in document order, but precede the ending node in document order. Return two types of nodes with non-null text: 1. Element parents of collapsed text nodes (since it is the element parent that has the collapsed text) 2. Non-collapsed text nodes If no such node exists, then do not set pageCurrent or idxCurrent and return false.
public static GetTextFollowing ( XPathNode &pageCurrent, int &idxCurrent, XPathNode pageEnd, int idxEnd ) : bool
pageCurrent XPathNode
idxCurrent int
pageEnd XPathNode
idxEnd int
return bool