http://bugzilla.novell.com/show_bug.cgi?id=506723
Summary: SubtreeXmlReader.Close doesn't position the parent
reader at the end of the subtree if Read has not been
called at least twice on the subtree reader
Classification: Mono
Product: Mono: Class Libraries
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Sys.XML
AssignedTo: [email protected]
ReportedBy: [email protected]
QAContact: [email protected]
Found By: ---
According to the MSDN docs, when calling XmlReader.Close on an XmlReader got
with XmlReader.ReadSubtree, the parent XmlReader should be positioned at the
end element of the subtree. In Mono, if you do not call Read on the subtree
reader twice or more, the parent reader will not be advanced to the end of the
subtree.
Test case:
using System;
using System.IO;
using System.Xml;
class MainClass
{
public static void Main(string[] args)
{
var xml =
"<root><thingList><thing>foo</thing><thing>bar</thing></thingList><stuffList><stuff>bat</stuff><stuff>baz</stuff></stuffList></root>";
using (var string_reader = new StringReader (xml)) {
using (var xml_reader = XmlReader.Create (string_reader)) {
xml_reader.ReadToFollowing ("thingList");
var sub_reader = xml_reader.ReadSubtree ();
sub_reader.Close ();
Console.WriteLine ("{0} {1}", xml_reader.NodeType, xml_reader.Name);
}
}
using (var string_reader = new StringReader (xml)) {
using (var xml_reader = XmlReader.Create (string_reader)) {
xml_reader.ReadToFollowing ("thingList");
var sub_reader = xml_reader.ReadSubtree ();
sub_reader.Read ();
sub_reader.Close ();
Console.WriteLine ("{0} {1}", xml_reader.NodeType, xml_reader.Name);
}
}
using (var string_reader = new StringReader (xml)) {
using (var xml_reader = XmlReader.Create (string_reader)) {
xml_reader.ReadToFollowing ("thingList");
var sub_reader = xml_reader.ReadSubtree ();
sub_reader.Read ();
sub_reader.Read ();
sub_reader.Close ();
Console.WriteLine ("{0} {1}", xml_reader.NodeType, xml_reader.Name);
}
}
}
}
Expected Result (this is what MS .NET prints):
EndElement thingList
EndElement thingList
EndElement thingList
Actual Result (this is what Mono prints):
Element thingList
Element thingList
EndElement thingList
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs