[Mono-bugs] [Bug 334752] New: XmlReader.Close() misbehaves when the XmlReader is got with XmlReader.ReadSubtree()

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 18 01:26:59 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=334752

           Summary: XmlReader.Close() misbehaves when the XmlReader is got
                    with XmlReader.ReadSubtree()
           Product: Mono: Class Libraries
           Version: 1.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: lunchtimemama at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: Development


According to the MSDN documentation on XmlReader.ReadSubtree() [1], "When the
new XmlReader has been closed, the original XmlReader will be positioned on the
EndElement node of the sub-tree." This is not the case in the Mono
implementation. Consider the following code:

##################
using System;
using System.IO;
using System.Xml;

namespace Test
{
    class MainClass
    {
        const string XML =
@"<root>
    <item-list>
        <item id='a'/>
        <item id='b'/>
    </item-list>
    <thing-list>
        <thing id='1'/>
        <thing id='2'/>
    </thing-list>
</root>";

        public static void Main(string[] args)
        {
            XmlReader reader = new XmlTextReader(new StringReader(XML));
            reader.ReadToFollowing("item-list");
            HandleList(reader.ReadSubtree());
            Console.WriteLine(string.Format("{0} {1}", reader.NodeType,
reader.Name));
        }

        static void HandleList(XmlReader reader)
        {
            reader.ReadToDescendant("item");
            reader.Close();
        }
    }
}
##################

The correct output (and the output given by .NET) is "EndElement item-list"
however the output under Mono is "Element item".

[1]
http://msdn2.microsoft.com/en-us/library/system.xml.xmlreader.readsubtree.aspx


-- 
Configure bugmail: https://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