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-06 06:36:13 +0300
committerAtsushi Eno <atsushieno@gmail.com>2006-01-06 06:36:13 +0300
commit2b56366922a906082267e37788588ae37bb21a7e (patch)
treee458af3b3cbc2d62ffae8b3b7d815c3bb0d73d7c /mcs/class/System.XML
parentf6413fb5db842ea249c0bc214db987eb4341f019 (diff)
2006-01-06 Atsushi Enomoto <atsushi@ximian.com>
* XmlValidatingReader.cs : ReadTypedValue() was not working with non-XmlSchemaDatatype types. * XsdValidatingReaderTests.cs : test for ReadTypeValue() with simple type restriction. svn path=/trunk/mcs/; revision=55127
Diffstat (limited to 'mcs/class/System.XML')
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog5
-rw-r--r--mcs/class/System.XML/System.Xml/XmlValidatingReader.cs5
-rw-r--r--mcs/class/System.XML/Test/System.Xml/ChangeLog5
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs25
4 files changed, 40 insertions, 0 deletions
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
index 18062f3d66c..82eca321b54 100644
--- a/mcs/class/System.XML/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-06 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlValidatingReader.cs : ReadTypedValue() was not working with
+ non-XmlSchemaDatatype types.
+
2006-01-05 Gert Driesen <drieseng@users.sourceforge.net>
* XmlTextWriter.cs: Modified WriteWhitespace to throw ArgumentException
diff --git a/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
index 8a971627951..8b22eb6a31e 100644
--- a/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
+++ b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs
@@ -547,6 +547,11 @@ namespace System.Xml
if (dtdReader == null)
return null;
XmlSchemaDatatype dt = schemaInfo.SchemaType as XmlSchemaDatatype;
+ if (dt == null) {
+ XmlSchemaType st = schemaInfo.SchemaType as XmlSchemaType;
+ if (st != null)
+ dt = st.Datatype;
+ }
if (dt == null)
return null;
switch (NodeType) {
diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog
index 8d80f6e5735..69ad13b7d2e 100644
--- a/mcs/class/System.XML/Test/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-06 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XsdValidatingReaderTests.cs : test for ReadTypeValue() with simple
+ type restriction.
+
2006-01-05 Gert Driesen <drieseng@users.sourceforge.net>
* XmlElementTests.cs: Improved tests for setting prefix to null
diff --git a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
index 6846a6b70a3..407aabb6a16 100644
--- a/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XsdValidatingReaderTests.cs
@@ -236,5 +236,30 @@ namespace MonoTests.System.Xml
while (!vr.EOF)
vr.Read ();
}
+
+ [Test]
+ public void ReadTypedValueSimpleTypeRestriction ()
+ {
+ string xml = "<root>xx</root><!-- after -->";
+ string xsd = @"
+<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:element name='root'>
+ <xs:simpleType>
+ <xs:restriction base='xs:string'>
+ <xs:minLength value='2' />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+</xs:schema>";
+ XmlTextReader xir =
+ new XmlTextReader (xml, XmlNodeType.Document, null);
+ XmlTextReader xsr =
+ new XmlTextReader (xsd, XmlNodeType.Document, null);
+ XmlValidatingReader vr = new XmlValidatingReader (xir);
+ vr.Schemas.Add (XmlSchema.Read (xsr, null));
+ vr.Read (); // root
+ AssertEquals ("xx", vr.ReadTypedValue ());
+ AssertEquals (XmlNodeType.EndElement, vr.NodeType);
+ }
}
}