// [PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")] internal override void ImportDerivedTypes(XmlQualifiedName baseName) { foreach (XmlSchema schema in Schemas) { if (Schemas.IsReference(schema)) { continue; } if (XmlSchemas.IsDataSet(schema)) { continue; } XmlSchemas.Preprocess(schema); foreach (object item in schema.SchemaTypes.Values) { if (item is XmlSchemaType) { XmlSchemaType type = (XmlSchemaType)item; if (type.DerivedFrom == baseName) { ImportType(type.QualifiedName, false); } } } } }
internal void CheckDuplicateElement(XmlSchemaElement element, string elementNs) { if (element == null) { return; } // only check duplicate definitions for top-level element if (element.Parent == null || !(element.Parent is XmlSchema)) { return; } XmlSchemaObjectTable elements = null; if (Schema != null && Schema.TargetNamespace == elementNs) { XmlSchemas.Preprocess(Schema); elements = Schema.Elements; } else if (Schemas != null) { elements = Schemas.GlobalElements; } else { return; } foreach (XmlSchemaElement e in elements.Values) { if (e.Name == element.Name && e.QualifiedName.Namespace == elementNs) { if (Match(e, element)) { return; } // XmlSerializableRootDupName=Cannot reconcile schema for '{0}'. Please use [XmlRoot] attribute to change name or namepace of the top-level element to avoid duplicate element declarations: element name='{1} namespace='{2}'. throw new InvalidOperationException(string.Format(ResXml.XmlSerializableRootDupName, _getSchemaMethod.DeclaringType.FullName, e.Name, elementNs)); } } }