System.Xml.Xsl.Runtime.XPathPrecedingDocOrderIterator.Create C# (CSharp) Method

Create() public method

Initialize the XPathPrecedingDocOrderIterator (return preceding nodes in document order, no possibility of duplicates).
public Create ( XPathNavigator input, XmlNavigatorFilter filter ) : void
input System.Xml.XPath.XPathNavigator
filter XmlNavigatorFilter
return void
        public void Create(XPathNavigator input, XmlNavigatorFilter filter) {
            // Save input node as current node
            this.navCurrent = XmlQueryRuntime.SyncToNavigator(this.navCurrent, input);
            this.filter = filter;
            PushAncestors();
        }

Usage Example

        /// <summary>
        /// Initialize the XPathPrecedingIterator (no possibility of duplicates).
        /// </summary>
        public void Create(XPathNavigator context, XmlNavigatorFilter filter)
        {
            XPathPrecedingDocOrderIterator wrapped = new XPathPrecedingDocOrderIterator();

            wrapped.Create(context, filter);

            // Fetch all preceding nodes in document order and push them onto the stack
            while (wrapped.MoveNext())
            {
                stack.Push(wrapped.Current.Clone());
            }
        }
All Usage Examples Of System.Xml.Xsl.Runtime.XPathPrecedingDocOrderIterator::Create
XPathPrecedingDocOrderIterator