Author: atsushi
Date: 2006-01-13 12:21:15 -0500 (Fri, 13 Jan 2006)
New Revision: 55523

Modified:
   trunk/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
   trunk/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
   trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
   trunk/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
Log:
2006-01-13  Atsushi Enomoto <[EMAIL PROTECTED]>

        * XsdValidatingReader.cs : whitespace nodes should be allowed inside
          empty or element-only content types. Fixed bug #77241.

        * XsdValidatingReaderTests.cs : test from bug #77241.



Modified: trunk/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog        2006-01-13 
16:38:57 UTC (rev 55522)
+++ trunk/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog        2006-01-13 
17:21:15 UTC (rev 55523)
@@ -1,3 +1,8 @@
+2006-01-13  Atsushi Enomoto <[EMAIL PROTECTED]>
+
+       * XsdValidatingReader.cs : whitespace nodes should be allowed inside
+         empty or element-only content types. Fixed bug #77241.
+
 2006-01-11  Atsushi Enomoto <[EMAIL PROTECTED]>
 
        * XmlSchemaValidatingReader.cs : removed unused constructors.

Modified: trunk/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs   
2006-01-13 16:38:57 UTC (rev 55522)
+++ trunk/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs   
2006-01-13 17:21:15 UTC (rev 55523)
@@ -1603,7 +1603,8 @@
                                        switch (ct.ContentType) {
                                        case XmlSchemaContentType.ElementOnly:
                                        case XmlSchemaContentType.Empty:
-                                               HandleError ("Not allowed 
character content was found.");
+                                               if (reader.NodeType != 
XmlNodeType.Whitespace)
+                                                       HandleError ("Not 
allowed character content was found.");
                                                break;
                                        }
                                }

Modified: trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog        2006-01-13 
16:38:57 UTC (rev 55522)
+++ trunk/mcs/class/System.XML/Test/System.Xml/ChangeLog        2006-01-13 
17:21:15 UTC (rev 55523)
@@ -1,5 +1,9 @@
 2006-01-13  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * XsdValidatingReaderTests.cs : test from bug #77241.
+
+2006-01-13  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * XmlTextWriterTests.cs : added some tests for XMLdecl state check.
 
 2006-01-12  Atsushi Enomoto  <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
===================================================================
--- trunk/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs      
2006-01-13 16:38:57 UTC (rev 55522)
+++ trunk/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs      
2006-01-13 17:21:15 UTC (rev 55523)
@@ -5,8 +5,10 @@
 //     Atsushi Enomoto <[EMAIL PROTECTED]>
 //
 // (C)2003 Atsushi Enomoto
+// (C)2005-2006 Novell, Inc.
 //
 using System;
+using System.IO;
 using System.Xml;
 using System.Xml.Schema;
 using NUnit.Framework;
@@ -289,5 +291,33 @@
                        AssertEquals ("  ", vr.ReadTypedValue ());
                        AssertEquals (XmlNodeType.EndElement, vr.NodeType);
                }
+
+               [Test] // bug #77241
+               public void EmptyContentAllowWhitespace ()
+               {
+                       string doc = @"
+<root>
+        <!-- some comment -->
+        <child/>
+</root>
+";
+                       string schema = @"
+<xsd:schema xmlns:xsd=""http://www.w3.org/2001/XMLSchema"";>
+    <xsd:element name=""root"">
+        <xsd:complexType>
+            <xsd:sequence>
+                <xsd:element name=""child"" type=""xsd:string"" />
+            </xsd:sequence>
+        </xsd:complexType>
+    </xsd:element>
+</xsd:schema>
+";
+                       XmlValidatingReader reader = new XmlValidatingReader (
+                               new XmlTextReader (new StringReader (doc)));
+                       reader.Schemas.Add (null,
+                               new XmlTextReader (new StringReader (schema)));
+                       while (reader.Read ())
+                               ;
+               }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to