[Mono-bugs] [Bug 76257][Wis] New - improper handling of xml declaration in XmlTextReader and NodeType.Element

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Sep 28 12:59:22 EDT 2005

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 csaba.halasz at gmail.com.


--- shadow/76257	2005-09-28 12:59:21.000000000 -0400
+++ shadow/76257.tmp.27300	2005-09-28 12:59:22.000000000 -0400
@@ -0,0 +1,67 @@
+Bug#: 76257
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: Sys.XML
+AssignedTo: atsushi at ximian.com                            
+ReportedBy: Csaba.Halasz at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: improper handling of xml declaration in XmlTextReader and NodeType.Element 
+Description of Problem:
+1. If you pass an xml fragment that contains an xml declaration with
+anything but version and encoding attributes, you get an exception.
+2. XmlTextReader skips the xml declaration (might not be a bug, but M$
+behaves differently)
+Steps to reproduce the problem:
+using System;
+using System.Xml;
+class Test
+        public static void Main(string[] args)
+        {
+                string xml = "<?xml version='1.0' encoding='utf-8'
+                XmlReader Reader = new XmlTextReader(xml,
+XmlNodeType.Element, null);
+                Reader.Read();
+                Console.WriteLine(Reader.NodeType);
+        }
+Actual Results:
+Unhandled Exception: System.Xml.XmlException: expected '?' (3F) but found
+'s' (73)
+in <0x0017c> System.Xml.XmlTextReader:Expect (Int32 expected)
+in <0x00036> System.Xml.XmlTextReader:Expect (System.String expected)
+in <0x00321> System.Xml.XmlTextReader:SkipTextDeclaration ()
+in <0x00220> System.Xml.XmlTextReader:InitializeContext (System.String url,
+System.Xml.XmlParserContext context, System.IO.TextReader fragment,
+XmlNodeType fragType)
+in <0x0009c> System.Xml.XmlTextReader:.ctor (System.String url,
+System.IO.TextReader fragment, XmlNodeType fragType,
+System.Xml.XmlParserContext context)
+in <0x00065> System.Xml.XmlTextReader:.ctor (System.String xmlFragment,
+XmlNodeType fragType, System.Xml.XmlParserContext context)
+in [0x00009] (at /home/hcs/Test.cs:10) Test:Main (System.String[] args)
+Expected Results:
+How often does this happen? 
+Additional Information:
+Tested with 1.1.9 20050927.
+Problem seems to be in System.Xml.XmlTextReader:SkipTextDeclaration()
+Hopefully not a duplicate this time ;-)

More information about the mono-bugs mailing list