/// <summary> /// Initialize the AncestorDocOrderIterator (return ancestor nodes in document order, no possibility of duplicates). /// </summary> public void Create(XPathNavigator context, XmlNavigatorFilter filter, bool orSelf) { AncestorIterator wrapped = new AncestorIterator(); wrapped.Create(context, filter, orSelf); // Fetch all ancestor nodes in reverse document order and push them onto the stack while (wrapped.MoveNext()) { stack.Push(wrapped.Current.Clone()); } }