System.Data.XSDSchema.CollectElementsAnnotations C# (CSharp) Method

CollectElementsAnnotations() private method

private CollectElementsAnnotations ( XmlSchema schema, ArrayList schemaList ) : void
schema System.Xml.Schema.XmlSchema
schemaList System.Collections.ArrayList
return void
        private void CollectElementsAnnotations(XmlSchema schema, ArrayList schemaList)
        {
            if (schemaList.Contains(schema))
            {
                return;
            }
            schemaList.Add(schema);

            foreach (object item in schema.Items)
            {
                if (item is XmlSchemaAnnotation)
                {
                    _annotations.Add((XmlSchemaAnnotation)item);
                }
                if (item is XmlSchemaElement)
                {
                    XmlSchemaElement elem = (XmlSchemaElement)item;
                    _elements.Add(elem);
                    _elementsTable[elem.QualifiedName] = elem;
                }
                if (item is XmlSchemaAttribute)
                {
                    XmlSchemaAttribute attr = (XmlSchemaAttribute)item;
                    _attributes[attr.QualifiedName] = attr;
                }
                if (item is XmlSchemaAttributeGroup)
                {
                    XmlSchemaAttributeGroup attr = (XmlSchemaAttributeGroup)item;
                    _attributeGroups[attr.QualifiedName] = attr;
                }
                if (item is XmlSchemaType)
                {
                    string MSDATATargetNamespace = null;
                    if (item is XmlSchemaSimpleType)
                    {
                        MSDATATargetNamespace = XSDSchema.GetMsdataAttribute((XmlSchemaType)item, Keywords.TARGETNAMESPACE);
                    }

                    XmlSchemaType type = (XmlSchemaType)item;
                    _schemaTypes[type.QualifiedName] = type;

                    // if we have a User Defined simple type, cache it so later we may need for mapping
                    // meanwhile more convinient solution would be to directly use schemaTypes, but it would be more complex to handle
                    XmlSchemaSimpleType xmlSimpleType = (item as XmlSchemaSimpleType);
                    if (xmlSimpleType != null)
                    {
                        if (_udSimpleTypes == null)
                        {
                            _udSimpleTypes = new Hashtable();
                        }

                        _udSimpleTypes[type.QualifiedName.ToString()] = xmlSimpleType;
                        DataColumn dc = (DataColumn)_existingSimpleTypeMap[type.QualifiedName.ToString()];
                        // Assumption is that our simple type qualified name ihas the same output as XmlSchemaSimpleType type.QualifiedName.ToString()
                        SimpleType tmpSimpleType = (dc != null) ? dc.SimpleType : null;

                        if (tmpSimpleType != null)
                        {
                            SimpleType tmpDataSimpleType = new SimpleType(xmlSimpleType);
                            string errorStr = tmpSimpleType.HasConflictingDefinition(tmpDataSimpleType);
                            if (errorStr.Length != 0)
                            {
                                throw ExceptionBuilder.InvalidDuplicateNamedSimpleTypeDelaration(tmpDataSimpleType.SimpleTypeQualifiedName, errorStr);
                            }
                        }
                    }
                }
            }
            foreach (XmlSchemaExternal include in schema.Includes)
            {
                if (include is XmlSchemaImport)
                    continue;
                if (include.Schema != null)
                {
                    CollectElementsAnnotations(include.Schema, schemaList);
                }
            }
        }

Same methods

XSDSchema::CollectElementsAnnotations ( XmlSchema schema ) : void