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-11-09 12:07:40 +0300
committerAtsushi Eno <atsushieno@gmail.com>2006-11-09 12:07:40 +0300
commit41f534fdfb9688865ed07fd2e937c15164af01fe (patch)
treef580bd234920de00265f9781d1b0511fac57acec /mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
parent5c4b82303ec366f75c0aa216d5db7c95f77dad41 (diff)
2006-11-09 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchemaImporter.cs : attributes might overlap by extending base content models. Since invalid content models are rejected by Compile(), simply ignore duplicating attributes. Note that it is basically hack, which should not skip derived ones but use them (but it is mostly harmless since the result is very unlikely to differ). * XmlSchemaImporterTests.cs : added ImportComplexDerivationByExtension(). svn path=/trunk/mcs/; revision=67581
Diffstat (limited to 'mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs')
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs18
1 files changed, 17 insertions, 1 deletions
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
index 35360517a90..fb5255dc7bb 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
@@ -686,6 +686,8 @@ namespace System.Xml.Serialization
void ImportAttributes (XmlQualifiedName typeQName, ClassMap cmap, XmlSchemaObjectCollection atts, XmlSchemaAnyAttribute anyat, CodeIdentifiers classIds)
{
+ atts = CollectAttributeUsesNonOverlap (atts, cmap);
+
if (anyat != null)
{
XmlTypeMapMemberAnyAttribute member = new XmlTypeMapMemberAnyAttribute ();
@@ -727,6 +729,20 @@ namespace System.Xml.Serialization
}
}
+ // Attributes might be redefined, so there is an existing attribute for the same name, skip it.
+ // FIXME: this is nothing more than just a hack.
+ // Basically it should use
+ // XmlSchemaComplexType.AttributeUses.
+ XmlSchemaObjectCollection CollectAttributeUsesNonOverlap (
+ XmlSchemaObjectCollection src, ClassMap map)
+ {
+ XmlSchemaObjectCollection atts = new XmlSchemaObjectCollection ();
+ foreach (XmlSchemaAttribute a in src)
+ if (map.GetAttribute (a.QualifiedName.Name, a.QualifiedName.Namespace) == null)
+ atts.Add (a);
+ return atts;
+ }
+
ListMap BuildArrayMap (XmlQualifiedName typeQName, XmlSchemaComplexType stype, out TypeData arrayTypeData)
{
if (encodedFormat)
@@ -1628,7 +1644,7 @@ namespace System.Xml.Serialization
}
else
{
- ns = typeQName.Namespace;
+ ns = attr.ParentIsSchema ? typeQName.Namespace : String.Empty;
return attr;
}
}