System.Xml.Xsl.Runtime.XmlNavigatorStack.Push C# (CSharp) Method

Push() public method

Push a navigator onto the stack
public Push ( XPathNavigator nav ) : void
nav System.Xml.XPath.XPathNavigator
return void
        public void Push(XPathNavigator nav) {
            if (this.stkNav == null)
            {
                this.stkNav = new XPathNavigator[InitialStackSize];
            }
            else
            {
                if (this.sp >= this.stkNav.Length)
                {
                    // Resize the stack
                    XPathNavigator[] stkOld = this.stkNav;
                    this.stkNav = new XPathNavigator[2 * this.sp];
                    Array.Copy(stkOld, this.stkNav, this.sp);
                }
            }

            this.stkNav[this.sp++] = nav;
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// If the context node-set returns a node that is contained in the subtree of the previous node,
        /// then returning children of each node in "natural" order may not correspond to document order.
        /// Therefore, in order to guarantee document order, keep a stack in order to push the sibling of
        /// ancestor nodes.  These siblings will not be returned until all of the descendants' children are
        /// returned first.
        /// </summary>
        private IteratorResult DocOrderMerge()
        {
            XmlNodeOrder cmp;

            Debug.Assert(_state == IteratorState.HaveCurrentHaveNext);

            // Compare location of navCurrent with navNext
            cmp = _navCurrent.ComparePosition(_navNext);

            // If navCurrent is before navNext in document order,
            // If cmp = XmlNodeOrder.Unknown, then navCurrent is before navNext (since input is is doc order)
            if (cmp == XmlNodeOrder.Before || cmp == XmlNodeOrder.Unknown)
            {
                // Then navCurrent can be returned (it is guaranteed to be first in document order)
                return(IteratorResult.HaveCurrentNode);
            }

            // If navCurrent is after navNext in document order, then delay returning navCurrent
            // Otherwise, discard navNext since it is positioned to the same node as navCurrent
            if (cmp == XmlNodeOrder.After)
            {
                _navStack.Push(_navCurrent);
                _navCurrent = _navNext;
                _navNext    = null;
            }

            // Need next input node
            _state = IteratorState.HaveCurrentNeedNext;
            return(IteratorResult.NeedInputNode);
        }
All Usage Examples Of System.Xml.Xsl.Runtime.XmlNavigatorStack::Push