diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2006-01-06 15:24:46 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2006-01-06 15:24:46 +0300 |
commit | fd4622ca847010ec7ba0752f0bf7bfc63502adea (patch) | |
tree | 8edec1a3af502f8827966f9d93f20c3b345205d2 /mcs/class | |
parent | 5d8e0ff8d2942ebf4dba2d585f01bc5dd4e78900 (diff) |
2006-01-06 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchemaSet.cs : Add() needs (consistent) namespace duplicate check.
* XmlSchemaSetTests.cs : re-enabled test for Add() which was
inconsistent in beta versions.
svn path=/trunk/mcs/; revision=55145
Diffstat (limited to 'mcs/class')
4 files changed, 23 insertions, 6 deletions
diff --git a/mcs/class/System.XML/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/System.Xml.Schema/ChangeLog index 1969b4b2ca6..99f5fe328ef 100644 --- a/mcs/class/System.XML/System.Xml.Schema/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Schema/ChangeLog @@ -1,5 +1,9 @@ 2006-01-06 Atsushi Enomoto <atsushi@ximian.com> + * XmlSchemaSet.cs : Add() needs (consistent) namespace duplicate check. + +2006-01-06 Atsushi Enomoto <atsushi@ximian.com> + * XmlSchemaSimpleTypeRestriction.cs : maxLength and minLength were likely to be ignored in ValidateNonListValueWithFacets(). * XmlSchemaValidator.cs : Don't use normalized string value as the diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs index 8b39ba965a3..d194f3bd879 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs @@ -158,9 +158,17 @@ namespace System.Xml.Schema } } - [MonoTODO ("It has weird namespace duplication check that is different from Add(XmlSchema).")] + void CheckDuplicateNS (string targetNamespace) + { + if (Schemas (GetSafeNs (targetNamespace)).Count > 0) + throw new ArgumentException (String.Format ("Corresponding schema for namespace '{0}' has been already added.", targetNamespace)); + } + public XmlSchema Add (string targetNamespace, XmlReader reader) { + // don't check it here; check only in-use TargetNamespace + //CheckDuplicateNS (targetNamespace); + XmlSchema schema = XmlSchema.Read (reader, handler); if (targetNamespace != null && targetNamespace.Length > 0) @@ -169,7 +177,6 @@ namespace System.Xml.Schema return schema; } - [MonoTODO ("Check the exact behavior when namespaces are in conflict (but it would be preferable to wait for 2.0 RTM).")] public void Add (XmlSchemaSet schemaSet) { ArrayList al = new ArrayList (); @@ -183,10 +190,12 @@ namespace System.Xml.Schema Add (schema); } - [MonoTODO ("We need to research more about the expected behavior")] public XmlSchema Add (XmlSchema schema) { - schemas.Add (schema); + if (!schemas.Contains (schema)) { + CheckDuplicateNS (schema.TargetNamespace); + schemas.Add (schema); + } AddGlobalComponents (schema); return schema; } @@ -327,7 +336,6 @@ namespace System.Xml.Schema return schemas; } - [MonoTODO] public ICollection Schemas (string targetNamespace) { targetNamespace = GetSafeNs (targetNamespace); diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog index 005d42464b9..9aa293571cf 100644 --- a/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog +++ b/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog @@ -1,3 +1,8 @@ +2006-01-06 Atsushi Enomoto <atsushi@ximian.com> + + * XmlSchemaSetTests.cs : re-enabled test for Add() which was + inconsistent in beta versions. + 2005-12-08 Atsushi Enomoto <atsushi@ximian.com> * XmlSchemaSetTests.cs : added set_CompilationSettings tests. diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs index d8d006fb860..27ba7b47646 100644 --- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs +++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaSetTests.cs @@ -56,7 +56,7 @@ namespace MonoTests.System.Xml } [Test] - [Ignore ("This behavior might be changed, since Add(XmlSchema) does not throw any exceptions, while this does.")] + //[Ignore ("This behavior might be changed, since Add(XmlSchema) does not throw any exceptions, while this does.")] [ExpectedException (typeof (ArgumentException))] public void AddTwice () { |