System.Xml.Serialization.SoapSchemaImporter.ImportTypeMembers C# (CSharp) Method

ImportTypeMembers() private method

private ImportTypeMembers ( XmlSchemaComplexType type, string typeNs, CodeIdentifiers members ) : System.Xml.Serialization.MemberMapping[]
type System.Xml.Schema.XmlSchemaComplexType
typeNs string
members CodeIdentifiers
return System.Xml.Serialization.MemberMapping[]
        MemberMapping[] ImportTypeMembers(XmlSchemaComplexType type, string typeNs, CodeIdentifiers members) {
            if (type.AnyAttribute != null) {
                throw new InvalidOperationException(Res.GetString(Res.XmlInvalidAnyAttributeUse, type.Name, type.QualifiedName.Namespace));
            }

            XmlSchemaObjectCollection items = type.Attributes;
            for (int i = 0; i < items.Count; i++) {
                object item = items[i];
                if (item is XmlSchemaAttributeGroup) {
                    throw new InvalidOperationException(Res.GetString(Res.XmlSoapInvalidAttributeUse, type.Name, type.QualifiedName.Namespace));
                }
                if (item is XmlSchemaAttribute) {
                    XmlSchemaAttribute attr = (XmlSchemaAttribute)item;
                    if (attr.Use != XmlSchemaUse.Prohibited) throw new InvalidOperationException(Res.GetString(Res.XmlSoapInvalidAttributeUse, type.Name, type.QualifiedName.Namespace));
                }
            }
            if (type.Particle != null) {
                ImportGroup(type.Particle, members, typeNs);
            }
            else if (type.ContentModel != null && type.ContentModel is XmlSchemaComplexContent) {
                XmlSchemaComplexContent model = (XmlSchemaComplexContent)type.ContentModel;

                if (model.Content is XmlSchemaComplexContentExtension) {
                    if (((XmlSchemaComplexContentExtension)model.Content).Particle != null) {
                        ImportGroup(((XmlSchemaComplexContentExtension)model.Content).Particle, members, typeNs);
                    }
                }
                else if (model.Content is XmlSchemaComplexContentRestriction) {
                    if (((XmlSchemaComplexContentRestriction)model.Content).Particle != null) {
                        ImportGroup(((XmlSchemaComplexContentRestriction)model.Content).Particle, members, typeNs);
                    }
                }
            }
            return (MemberMapping[])members.ToArray(typeof(MemberMapping));
        }