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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 8 Jul 2004 01:21:42 -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 ianm@activestate.com.

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

--- shadow/61274	2004-07-08 01:21:42.000000000 -0400
+++ shadow/61274.tmp.5328	2004-07-08 01:21:42.000000000 -0400
@@ -0,0 +1,60 @@
+Bug#: 61274
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ianm@activestate.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlValidatingReader throws exception if xml declatation present
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+using XmlValidatingReader to read a simple xml file ( as a string ) fails
+if that document has an <xml version="1.0"?> declaration present. 
+
+Steps to reproduce the problem:
+1. Compile and Run the following code snippet:
+string xmlText = "<?xml version=\"1.0\"?><test><a></a></test>";
+        Console.WriteLine("xmlText {0}", xmlText );
+        XmlValidatingReader reader = new XmlValidatingReader(xmlText,
+XmlNodeType.Element, null);   
+        while (reader.Read()) {
+            //reader.Name;
+        }       
+
+Actual Results:
+Unhandled Exception: System.Xml.XmlException: XML declaration cannot appear
+in this state. Line 1, position 5.
+in <0x0004f> System.Xml.XmlTextReader:ReadXmlDeclaration ()
+in <0x00051> System.Xml.XmlTextReader:ReadProcessingInstruction ()
+in <0x00062> System.Xml.XmlTextReader:ReadTag ()
+in <0x000cc> System.Xml.XmlTextReader:ReadContent ()
+in <0x0017f> System.Xml.XmlTextReader:Read ()
+in <0x0030a> Mono.Xml.DTDValidatingReader:ReadContent ()
+in <0x000b4> Mono.Xml.DTDValidatingReader:Read ()
+in <0x000b6> Mono.Xml.Schema.XsdValidatingReader:Read ()
+in <0x002a8> System.Xml.XmlValidatingReader:Read ()
+in <0x0004e> ConsoleApplication9.Class1:TestXmlValidatingReader ()
+in <0x00007> ConsoleApplication9.Class1:Main (string[])
+
+Expected Results:
+it should just read thru the document successfully as it does on the ms
+.net implementation.
+
+How often does this happen? 
+Consistently on both windows and linux with mono 1.0
+
+
+Additional Information:
+removing the xml declaration causes it to work.