[Mono-bugs] [Bug 506723] New: 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
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun May 24 00:30:04 EDT 2009
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: atsushi at ximian.com
ReportedBy: lunchtimemama at gmail.com
QAContact: mono-bugs at lists.ximian.com
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.
More information about the mono-bugs
mailing list