Author: atsushi
Date: 2007-10-19 01:36:00 -0400 (Fri, 19 Oct 2007)
New Revision: 87812
Modified:
trunk/mcs/class/System.XML/Mono.Xml/ChangeLog
trunk/mcs/class/System.XML/Mono.Xml/SubtreeXmlReader.cs
trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
Log:
2007-10-19 Atsushi Enomoto <[EMAIL PROTECTED]>
* SubtreeXmlReader.cs : when a subtree reader is closed, the original
reader moves to the end of the subtree. Fixed bug #334752, patch by
Scott Peterson.
* XmlReaderCommonTests.cs : added test for bug #334752.
Modified: trunk/mcs/class/System.XML/Mono.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml/ChangeLog 2007-10-19 05:32:09 UTC
(rev 87811)
+++ trunk/mcs/class/System.XML/Mono.Xml/ChangeLog 2007-10-19 05:36:00 UTC
(rev 87812)
@@ -1,3 +1,9 @@
+2007-10-19 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * SubtreeXmlReader.cs : when a subtree reader is closed, the original
+ reader moves to the end of the subtree. Fixed bug #334752, patch by
+ Scott Peterson.
+
2007-08-09 Atsushi Enomoto <[EMAIL PROTECTED]>
* SubtreeXmlReader.cs XmlFilterReader.cs : further dependent changes.
Modified: trunk/mcs/class/System.XML/Mono.Xml/SubtreeXmlReader.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml/SubtreeXmlReader.cs 2007-10-19
05:32:09 UTC (rev 87811)
+++ trunk/mcs/class/System.XML/Mono.Xml/SubtreeXmlReader.cs 2007-10-19
05:36:00 UTC (rev 87812)
@@ -142,7 +142,8 @@
public override void Close ()
{
- // do nothing
+ while (Reader.Depth > startDepth && Read ())
+ ;
}
public override string GetAttribute (int i)
Modified: trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog 2007-10-19
05:32:09 UTC (rev 87811)
+++ trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog 2007-10-19
05:36:00 UTC (rev 87812)
@@ -1,3 +1,7 @@
+2007-10-19 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * XmlReaderCommonTests.cs : added test for bug #334752.
+
2007-09-28 Atsushi Enomoto <[EMAIL PROTECTED]>
* XmlWriterTests.cs : added WriteNodeXPathNavigatorAttribute().
Modified: trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
2007-10-19 05:32:09 UTC (rev 87811)
+++ trunk/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
2007-10-19 05:36:00 UTC (rev 87812)
@@ -2001,6 +2001,24 @@
AssertEquals (String.Empty,
reader.ReadElementContentAsString ("sample", ""));
AssertEquals (XmlNodeType.EndElement, reader.NodeType);
}
+
+ [Test]
+ public void ReadSubtreeClose ()
+ {
+ // bug #334752
+ string xml = @"<root><item-list><item id='a'/><item
id='b'/></item-list></root>";
+ RunTest (xml, new TestMethod (ReadSubtreeClose));
+ }
+
+ void ReadSubtreeClose (XmlReader reader)
+ {
+ reader.ReadToFollowing ("item-list");
+ XmlReader sub = reader.ReadSubtree ();
+ sub.ReadToDescendant ("item");
+ sub.Close ();
+ AssertEquals ("#1", XmlNodeType.EndElement,
reader.NodeType);
+ AssertEquals ("#2", "item-list", reader.Name);
+ }
#endif
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches