[Mono-bugs] [Bug 52558][Nor] New - No error reported on unexpected whitespace in XmlValidatingReader

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 13 Jan 2004 01:23:53 -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 atsushi@ximian.com.

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

--- shadow/52558	2004-01-13 01:23:53.000000000 -0500
+++ shadow/52558.tmp.32298	2004-01-13 01:23:53.000000000 -0500
@@ -0,0 +1,83 @@
+Bug#: 52558
+Product: Mono/Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: Sys.XML
+AssignedTo: atsushi@ximian.com                            
+ReportedBy: jaak@zd.com.pl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: No error reported on unexpected whitespace in XmlValidatingReader
+
+The following XML:
+
+============
+<?xml version="1.0" encoding="utf-8"?>
+<root xmlns="http://tempuri.org/">
+</root>
+============
+
+doesn't cause an error when validated against:
+
+============
+<?xml version="1.0" encoding="utf-8" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    xmlns:test="http://tempuri.org/" 
+    elementFormDefault="qualified" 
+    targetNamespace="http://tempuri.org/" 
+    xmlns="http://tempuri.org/">
+
+	<xsd:element name="root" type="test:RootInfo" />
+
+	<xsd:complexType name="RootInfo">
+	</xsd:complexType>
+</xsd:schema>
+============
+
+This happens every time.
+
+MS .NET 1.1 throws:
+
+Unhandled Exception: System.InvalidOperationException: There is an error 
+in the XML document. ---> S
+ystem.Xml.Schema.XmlSchemaException: Element cannot contain text or 
+whitespace. Content model is emp
+ty. An error occurred at file:///X:/work/empty_xml_bug/test.xml(2, 35).
+   at System.Xml.XmlValidatingReader.InternalValidationCallback(Object 
+sender, ValidationEventArgs e
+)
+   at System.Xml.Schema.Validator.SendValidationEvent(XmlSchemaException 
+e, XmlSeverityType severity
+)
+   at System.Xml.Schema.Validator.SendValidationEvent(String code, String 
+arg)
+   at System.Xml.Schema.Validator.ValidateWhitespace()
+   at System.Xml.XmlValidatingReader.ReadWithCollectTextToken()
+   at System.Xml.XmlValidatingReader.Read()
+   at System.Xml.XmlReader.ReadStartElement()
+   at 
+Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
+1_RootInfo(Boolean i
+sNullable, Boolean checkType)
+   at 
+Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read
+3_root()
+   --- End of inner exception stack trace ---
+   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader 
+xmlReader)
+   at Class1.Main(String[] args)
+
+
+To reproduce: compile and run the attached program.
+
+------- Additional Comments From jaak@zd.com.pl  2003-12-25 06:40 -------
+Created an attachment (id=6327)
+test program to reproduce the problem
+