Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2006-01-13 20:21:15 +0300
committerAtsushi Eno <atsushieno@gmail.com>2006-01-13 20:21:15 +0300
commitf67469ac41a5154b9600a2b3b7f5e89dd5ea43cf (patch)
tree9309876d76b595792aafc235ee75c8e8e154e3a5
parentb23ee78bf19d2930207091291a23800a95bfb103 (diff)
2006-01-13 Atsushi Enomoto <atsushi@ximian.com>
* XsdValidatingReader.cs : whitespace nodes should be allowed inside empty or element-only content types. Fixed bug #77241. * XsdValidatingReaderTests.cs : test from bug #77241. svn path=/trunk/mcs/; revision=55523
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/ChangeLog5
-rw-r--r--mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs3
-rw-r--r--mcs/class/System.XML/Test/System.Xml/ChangeLog4
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs30
4 files changed, 41 insertions, 1 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog b/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
index a7074156a40..270f7f81d96 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-13 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdValidatingReader.cs : whitespace nodes should be allowed inside
+ empty or element-only content types. Fixed bug #77241.
+
2006-01-11 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchemaValidatingReader.cs : removed unused constructors.
diff --git a/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs b/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
index 3d712392ec4..a84f88c3602 100644
--- a/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
+++ b/mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
@@ -1603,7 +1603,8 @@ namespace Mono.Xml.Schema
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;
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog
index 1a6890afd70..1e0736ea1fb 100644
--- a/mcs/class/System.XML/Test/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog
@@ -1,5 +1,9 @@
2006-01-13 Atsushi Enomoto <atsushi@ximian.com>
+ * XsdValidatingReaderTests.cs : test from bug #77241.
+
+2006-01-13 Atsushi Enomoto <atsushi@ximian.com>
+
* XmlTextWriterTests.cs : added some tests for XMLdecl state check.
2006-01-12 Atsushi Enomoto <atsushi@ximian.com>
diff --git a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
index 3ed1698c6b6..73b6e6230c5 100644
--- a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
@@ -5,8 +5,10 @@
// Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
//
// (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 @@ namespace MonoTests.System.Xml
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 ())
+ ;
+ }
}
}