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:
Diffstat (limited to 'mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs')
-rw-r--r--mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs18
1 files changed, 13 insertions, 5 deletions
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);