[Mono-bugs] [Bug 72298][Nor] New - XmlDocument.ReadNode does not stop after reading node

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 7 Feb 2005 15:18:13 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by dominz@wp.pl.

http://bugzilla.ximian.com/show_bug.cgi?id=72298

--- shadow/72298	2005-02-07 15:18:13.000000000 -0500
+++ shadow/72298.tmp.22905	2005-02-07 15:18:13.000000000 -0500
@@ -0,0 +1,48 @@
+Bug#: 72298
+Product: Mono: Class Libraries
+Version: 1.0
+OS: 
+OS Details: debian sarge/sid
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dominz@wp.pl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlDocument.ReadNode does not stop after reading node
+
+System,.Xml version 1.0.5000.0
+
+Description of Problem:
+XmlDocument.ReadNode should read one node and stop, but it doesn't stop and
+throws "Multiple document element was detected".
+It stops correctly only when there is any char or new line between elements
+In code below test1 throws exception:
+
+using System;
+using System.IO;
+using System.Xml;
+
+class MainClass
+{
+	public static void Main(string[] args)
+	{
+		string test1 = "<a></a><b></b>";  
+		string test2 = "<a></a>\n<b></b>";
+		string test2 = "<a></a> <b></b>";
+		StringReader stringReader = new StringReader(test1);
+		XmlReader xmlReader = new XmlTextReader(stringReader);
+		XmlDocument doc = new XmlDocument();
+		try {
+			XmlNode node = doc.ReadNode(xmlReader); 
+		}
+		catch (Exception e) {
+			Console.WriteLine(e.Message);
+		}
+	}
+}