hack SettingValueElement.Unmerge().
[mono.git] / mcs / class / System.XML / System.Xml.XPath / Iterator.cs
index 7fd1d86d223c0f9e5c627e4ac656a37724525b5e..26eebc50b724b13fe012abdf7d6de2b6ffc929d3 100644 (file)
@@ -35,12 +35,7 @@ using System.Collections;
 using System.Xml;
 using System.Xml.XPath;
 using System.Xml.Xsl;
-
-#if NET_2_0
 using NSResolver = System.Xml.IXmlNamespaceResolver;
-#else
-using NSResolver = System.Xml.XmlNamespaceManager;
-#endif
 
 namespace System.Xml.XPath
 {
@@ -491,26 +486,15 @@ namespace System.Xml.XPath
                        navigators = new ArrayList ();
 
                        XPathNavigator ancestors = startPosition.Clone ();
-                       if (!ancestors.MoveToParent ())
-                               return;
-                       while (ancestors.NodeType != XPathNodeType.Root) {
+                       while (ancestors.NodeType != XPathNodeType.Root && ancestors.MoveToParent ())
                                navigators.Add (ancestors.Clone ());
-                               ancestors.MoveToParent ();
-                       }
                        currentPosition = navigators.Count;
                }
 
                public override bool MoveNextCore ()
                {
-                       if (navigators == null) {
+                       if (navigators == null)
                                CollectResults ();
-                               if (startPosition.NodeType != XPathNodeType.Root) {
-                                       // First time it returns Root
-                                       _nav.MoveToRoot ();
-//                                     Current.MoveTo (_nav);
-                                       return true;
-                               }
-                       }
                        if (currentPosition == -1)
                                return false;
                        if (currentPosition-- == 0) {
@@ -543,7 +527,7 @@ namespace System.Xml.XPath
 
                public DescendantIterator (BaseIterator iter) : base (iter) {}
 
-               private DescendantIterator (DescendantIterator other) : base (other)
+               private DescendantIterator (DescendantIterator other) : base (other, true)
                {
                        _depth = other._depth;
                        _finished = other._finished;