2008-02-27 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Wed, 27 Feb 2008 11:45:11 +0000 (11:45 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Wed, 27 Feb 2008 11:45:11 +0000 (11:45 -0000)
* XPathNavigator.cs : in some MoveTo*() methods, it should allow any
  destination node when "type" is XPathNodeType.All. Based on the
  patch by Sanghyeon Seo, fixed bug #365112.

* XPathNavigatorTests.cs : added test for bug #365112.

svn path=/trunk/mcs/; revision=96753

mcs/class/System.XML/System.Xml.XPath/ChangeLog
mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs
mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog
mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorTests.cs

index 44328cfd1f899734a1fadd9996ce67b3b42891db..2c286150b721c0a023e9a784ed1d06d5b4e8fd2b 100644 (file)
@@ -1,3 +1,9 @@
+2008-02-27  Atsushi Enomoto <atsushi@ximian.com>
+
+       * XPathNavigator.cs : in some MoveTo*() methods, it should allow any
+         destination node when "type" is XPathNodeType.All. Based on the
+         patch by Sanghyeon Seo, fixed bug #365112.
+
 2008-02-12  Atsushi Enomoto <atsushi@ximian.com>
 
        * DefaultContext.cs : now number formatting for "R" works fine, so
index 0e095883abc13fc1e2b3d887d782b70f9dc180ca..bcecf89795f60f4ca2ffd4bface20c8799059375 100644 (file)
@@ -737,7 +737,7 @@ namespace System.Xml.XPath
                {
                        XPathNavigator nav = Clone ();
                        while (nav.MoveToNext ()) {
-                               if (nav.NodeType == type) {
+                               if (type == XPathNodeType.All || nav.NodeType == type) {
                                        MoveTo (nav);
                                        return true;
                                }
@@ -823,7 +823,7 @@ namespace System.Xml.XPath
                                }
                                if (end != null && end.IsSamePosition (nav))
                                        return false;
-                               if (nav.NodeType == type) {
+                               if (type == XPathNodeType.All || nav.NodeType == type) {
                                        MoveTo (nav);
                                        return true;
                                }
index 5d32b5cc3070239f3037c96f3c07fcd5ca1110c2..02e552358bcba3e499bbe339f2bdb06ff49bea76 100644 (file)
@@ -1,3 +1,7 @@
+2008-02-27  Atsushi Enomoto <atsushi@ximian.com>
+
+       * XPathNavigatorTests.cs : added test for bug #365112.
+
 2007-11-29  Atsushi Enomoto <atsushi@ximian.com>
 
        * XPathNavigatorTests.cs : added ValueAs() test.
index a5d1b19e428d25509604a7def6c92b2d094e33a3..938c602c1359d87fecdcbe221347f696d5e3e342 100644 (file)
@@ -640,6 +640,19 @@ namespace MonoTests.System.Xml
                        AssertEquals ("1", nav.ValueAs (typeof (string), null));
                        AssertEquals (1, nav.ValueAs (typeof (int), null));
                }
+
+               [Test]
+               public void MoveToFollowingNodeTypeAll ()
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       doc.LoadXml ("<root><child/><child2/></root>");
+                       XPathNavigator nav = doc.CreateNavigator ();
+                       Assert ("#1", nav.MoveToFollowing (XPathNodeType.All));
+                       Assert ("#2", nav.MoveToFollowing (XPathNodeType.All));
+                       AssertEquals ("#3", "child", nav.LocalName);
+                       Assert ("#4", nav.MoveToNext (XPathNodeType.All));
+                       AssertEquals ("#5", "child2", nav.LocalName);
+               }
 #endif
        }
 }