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

ImportDataType() private method

private ImportDataType ( XmlSchemaSimpleType dataType, string typeNs, string identifier, bool isList ) : TypeMapping
dataType System.Xml.Schema.XmlSchemaSimpleType
typeNs string
identifier string
isList bool
return TypeMapping
        TypeMapping ImportDataType(XmlSchemaSimpleType dataType, string typeNs, string identifier, bool isList) {
            TypeMapping mapping = ImportNonXsdPrimitiveDataType(dataType, typeNs);
            if (mapping != null)
                return mapping;

            if (dataType.Content is XmlSchemaSimpleTypeRestriction) {
                XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction)dataType.Content;
                foreach (object o in restriction.Facets) {
                    if (o is XmlSchemaEnumerationFacet) {
                        return ImportEnumeratedDataType(dataType, typeNs, identifier, isList);
                    }
                }
            }
            else if (dataType.Content is XmlSchemaSimpleTypeList || dataType.Content is XmlSchemaSimpleTypeUnion) {
                if (dataType.Content is XmlSchemaSimpleTypeList) {
                    // check if we have enumeration list
                    XmlSchemaSimpleTypeList list = (XmlSchemaSimpleTypeList)dataType.Content;
                    if (list.ItemType != null) {
                        mapping = ImportDataType(list.ItemType, typeNs, identifier, true);
                        if (mapping != null) {
                            return mapping;
                        }
                    }
                }
                mapping = new PrimitiveMapping();
                mapping.TypeDesc = Scope.GetTypeDesc(typeof(string));
                mapping.TypeName = mapping.TypeDesc.DataType.Name;
                return mapping;
            }
            return ImportPrimitiveDataType(dataType);
        }