Browse Source

2006-12-05 Atsushi Enomoto <[email protected]>

	* XmlReader.cs : new 2.0 MoveToAttribute(int) failed to move to the
	  final attribute in an element.

	* XPathNavigatorReaderTests.cs : added test for MoveToAttribute(int).


svn path=/trunk/mcs/; revision=69026
Atsushi Eno 19 years ago
parent
commit
d595cb3fbd

+ 5 - 0
mcs/class/System.XML/System.Xml/ChangeLog

@@ -1,3 +1,8 @@
+2006-12-05  Atsushi Enomoto <[email protected]>
+
+	* XmlReader.cs : new 2.0 MoveToAttribute(int) failed to move to the
+	  final attribute in an element.
+
 2006-12-05  Atsushi Enomoto <[email protected]>
 2006-12-05  Atsushi Enomoto <[email protected]>
 
 
 	* XmlNode.cs : GetPrefixOfNamespace() was not correctly searching
 	* XmlNode.cs : GetPrefixOfNamespace() was not correctly searching

+ 1 - 1
mcs/class/System.XML/System.Xml/XmlReader.cs

@@ -487,7 +487,7 @@ namespace System.Xml
 			if (i >= AttributeCount)
 			if (i >= AttributeCount)
 				throw new ArgumentOutOfRangeException ();
 				throw new ArgumentOutOfRangeException ();
 			MoveToFirstAttribute ();
 			MoveToFirstAttribute ();
-			for (int a = 1; a < i; a++)
+			for (int a = 0; a < i; a++)
 				MoveToNextAttribute ();
 				MoveToNextAttribute ();
 		}
 		}
 #else
 #else

+ 4 - 0
mcs/class/System.XML/Test/System.Xml.XPath/ChangeLog

@@ -1,3 +1,7 @@
+2006-12-05  Atsushi Enomoto <[email protected]>
+
+	* XPathNavigatorReaderTests.cs : added test for MoveToAttribute(int).
+
 2006-12-05  Atsushi Enomoto <[email protected]>
 2006-12-05  Atsushi Enomoto <[email protected]>
 
 
 	* XPathNavigatorTests.cs : added test for XPath navigator editor's
 	* XPathNavigatorTests.cs : added test for XPath navigator editor's

+ 15 - 0
mcs/class/System.XML/Test/System.Xml.XPath/XPathNavigatorReaderTests.cs

@@ -664,6 +664,21 @@ namespace MonoTests.System.Xml.XPath
 			nav.MoveToFirstChild ();
 			nav.MoveToFirstChild ();
 			nav.ReadSubtree ();
 			nav.ReadSubtree ();
 		}
 		}
+
+		[Test]
+		public void ReadSubtreeAttributesByIndex ()
+		{
+			XmlWriter xw;
+			XmlDocument doc = new XmlDocument ();
+			doc.LoadXml ("<u:Timestamp u:Id='ID1' xmlns:u='urn:foo'></u:Timestamp>");
+			XmlReader r = doc.CreateNavigator ().ReadSubtree ();
+			r.Read ();
+			r.MoveToAttribute (0);
+			if (r.LocalName != "Id")
+				r.MoveToAttribute (1);
+				if (r.LocalName != "Id")
+					Assert.Fail ("Should move to the attribute.");
+		}
 	}
 	}
 }
 }