[Mono-bugs] [Bug 61274][Wis] Changed - XmlValidatingReader throws exception if xml declatation present

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 8 Jul 2004 22:37:35 -0400 (EDT)


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 atsushi@ximian.com.

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

--- shadow/61274	2004-07-08 21:07:21.000000000 -0400
+++ shadow/61274.tmp.18154	2004-07-08 22:37:35.000000000 -0400
@@ -87,6 +87,35 @@
 ------- Additional Comments From atsushi@ximian.com  2004-07-08 20:31 -------
 IMHO apparently we should not "fix" this "problem".
 
 ------- Additional Comments From ianm@activestate.com  2004-07-08 21:07 -------
 hmm. Don't you think the compatibility with ms.net would be nice in
 this case ? 
+
+------- Additional Comments From atsushi@ximian.com  2004-07-08 22:37 -------
+Yes. Why it is required to "fix" ? Apparently XML declaration is not
+acceptable as a content of an element.
+
+It is not absolute principle, but my basic thought is that we should
+rather correct Microsoft and users by rejecting their mistakes rather
+than accept their badness by just copycatting.
+
+Index: System.Xml/XmlTextReader.cs
+===================================================================
+RCS file: /mono/mcs/class/System.XML/System.Xml/XmlTextReader.cs,v
+retrieving revision 1.123
+diff -u -r1.123 XmlTextReader.cs
+--- System.Xml/XmlTextReader.cs 21 Jun 2004 18:06:53 -0000      1.123
++++ System.Xml/XmlTextReader.cs 9 Jul 2004 02:29:47 -0000
+@@ -1893,7 +1893,7 @@
+                // The reader is positioned after "<?xml "
+                private void ReadXmlDeclaration ()
+                {
+-                       if (currentState != XmlNodeType.None) {
++                       if (currentState != XmlNodeType.None &&
+!allowMultipleRoot) {
+                                throw new XmlException (this as
+IXmlLineInfo,
+                                        "XML declaration cannot appear
+in this state.");
+                        }
+