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

Implementation of a Node in the XPath/XQuery data model. 1. All nodes are stored in variable-size pages (max 65536 nodes/page) of XPathNode structuSR. 2. Pages are sequentially numbered. Nodes are allocated in strict document order. 3. Node references take the form of a (page, index) pair. 4. Each node explicitly stores a parent and a sibling reference. 5. If a node has one or more attributes and/or non-collapsed content children, then its first child is stored in the next slot. If the node is in the last slot of a page, then its first child is stored in the first slot of the next page. 6. Attributes are linked together at the start of the child list. 7. Namespaces are allocated in totally separate pages. Elements are associated with declared namespaces via a hashtable map in the document. 8. Name parts are always non-null (string.Empty for nodes without names) 9. XPathNodeInfoAtom contains all information that is common to many nodes in a document, and therefore is atomized to save space. This includes the document, the name, the child, sibling, parent, and value pages, and the schema type. 10. The node structure is 20 bytes in length. Out-of-line overhead is typically 2-4 bytes per node.
Mostra file Open project: gbarnett/shared-source-cli-2.0 Class Usage Examples

Public Methods

Method Description
Create ( XPathNodeInfoAtom info, XPathNodeType xptyp, int idxParent ) : void

Constructs a XPathNode. Later, the idxSibling and value fields may be fixed up.

Create ( XPathNodePageInfo pageInfo ) : void

Constructs the 0th XPathNode in each page, which contains only page information.

ElementMatch ( string localName, string namespaceName ) : bool

Returns true if this is an Element node with a name that matches the specified localName and namespaceName. Assume that localName has been atomized, but namespaceName has not.

GetParent ( XPathNode &pageNode ) : int

Returns the parent of this node. If this node has no parent, then 0 is returned.

GetRoot ( XPathNode &pageNode ) : int

Returns the root node of the current document. This always succeeds.

GetSibling ( XPathNode &pageNode ) : int

Returns the next sibling of this node. If this node has no next sibling, then 0 is returned.

GetSimilarElement ( XPathNode &pageNode ) : int

Returns the next element in document order that has the same local name hashcode as this element. If there are no similar elements, then 0 is returned.

NameMatch ( string localName, string namespaceName ) : bool

Returns true if this node's name matches the specified localName and namespaceName. Assume that localName has been atomized, but namespaceName has not.

SetCollapsedLineInfoOffset ( int posOffset ) : void

Set the position offset of this element's collapsed text.

SetCollapsedValue ( string value ) : void

Create a collapsed text node on this element having the specified value.

SetEmptyValue ( bool allowShortcutTag ) : void

Create an empty element value.

SetLineInfoOffsets ( int lineNumOffset, int linePosOffset ) : void

Set this node's line number information.

SetParentProperties ( XPathNodeType xptyp ) : void

This method is called when a new child is appended to this node's list of attributes and children. The type of the new child is used to determine how various parent properties should be set.

SetSibling ( XPathNodeInfoTable infoTable, XPathNode pageSibling, int idxSibling ) : void

Link this node to its next sibling. If "pageSibling" is different than the one stored in the InfoAtom, re-atomize.

SetSimilarElement ( XPathNodeInfoTable infoTable, XPathNode pageSimilar, int idxSimilar ) : void

Link this element to the next element in document order that shares a local name having the same hash code. If "pageSimilar" is different than the one stored in the InfoAtom, re-atomize.

SetValue ( string value ) : void

Set this node's value.

Method Details

Create() public method

Constructs a XPathNode. Later, the idxSibling and value fields may be fixed up.
public Create ( XPathNodeInfoAtom info, XPathNodeType xptyp, int idxParent ) : void
info XPathNodeInfoAtom
xptyp XPathNodeType
idxParent int
return void

Create() public method

Constructs the 0th XPathNode in each page, which contains only page information.
public Create ( XPathNodePageInfo pageInfo ) : void
pageInfo XPathNodePageInfo
return void

ElementMatch() public method

Returns true if this is an Element node with a name that matches the specified localName and namespaceName. Assume that localName has been atomized, but namespaceName has not.
public ElementMatch ( string localName, string namespaceName ) : bool
localName string
namespaceName string
return bool

GetParent() public method

Returns the parent of this node. If this node has no parent, then 0 is returned.
public GetParent ( XPathNode &pageNode ) : int
pageNode XPathNode
return int

GetRoot() public method

Returns the root node of the current document. This always succeeds.
public GetRoot ( XPathNode &pageNode ) : int
pageNode XPathNode
return int

GetSibling() public method

Returns the next sibling of this node. If this node has no next sibling, then 0 is returned.
public GetSibling ( XPathNode &pageNode ) : int
pageNode XPathNode
return int

GetSimilarElement() public method

Returns the next element in document order that has the same local name hashcode as this element. If there are no similar elements, then 0 is returned.
public GetSimilarElement ( XPathNode &pageNode ) : int
pageNode XPathNode
return int

NameMatch() public method

Returns true if this node's name matches the specified localName and namespaceName. Assume that localName has been atomized, but namespaceName has not.
public NameMatch ( string localName, string namespaceName ) : bool
localName string
namespaceName string
return bool

SetCollapsedLineInfoOffset() public method

Set the position offset of this element's collapsed text.
public SetCollapsedLineInfoOffset ( int posOffset ) : void
posOffset int
return void

SetCollapsedValue() public method

Create a collapsed text node on this element having the specified value.
public SetCollapsedValue ( string value ) : void
value string
return void

SetEmptyValue() public method

Create an empty element value.
public SetEmptyValue ( bool allowShortcutTag ) : void
allowShortcutTag bool
return void

SetLineInfoOffsets() public method

Set this node's line number information.
public SetLineInfoOffsets ( int lineNumOffset, int linePosOffset ) : void
lineNumOffset int
linePosOffset int
return void

SetParentProperties() public method

This method is called when a new child is appended to this node's list of attributes and children. The type of the new child is used to determine how various parent properties should be set.
public SetParentProperties ( XPathNodeType xptyp ) : void
xptyp XPathNodeType
return void

SetSibling() public method

Link this node to its next sibling. If "pageSibling" is different than the one stored in the InfoAtom, re-atomize.
public SetSibling ( XPathNodeInfoTable infoTable, XPathNode pageSibling, int idxSibling ) : void
infoTable XPathNodeInfoTable
pageSibling XPathNode
idxSibling int
return void

SetSimilarElement() public method

Link this element to the next element in document order that shares a local name having the same hash code. If "pageSimilar" is different than the one stored in the InfoAtom, re-atomize.
public SetSimilarElement ( XPathNodeInfoTable infoTable, XPathNode pageSimilar, int idxSimilar ) : void
infoTable XPathNodeInfoTable
pageSimilar XPathNode
idxSimilar int
return void

SetValue() public method

Set this node's value.
public SetValue ( string value ) : void
value string
return void