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

ImportElement() private method

private ImportElement ( XmlSchemaElement element, string ns ) : ElementAccessor
element System.Xml.Schema.XmlSchemaElement
ns string
return ElementAccessor
        ElementAccessor ImportElement(XmlSchemaElement element, string ns) {
            if (!element.RefName.IsEmpty) {
                throw new InvalidOperationException(Res.GetString(Res.RefSyntaxNotSupportedForElements0, element.RefName.Name, element.RefName.Namespace));
            }

            if (element.Name.Length == 0) {
                XmlQualifiedName parentType = XmlSchemas.GetParentName(element);
                throw new InvalidOperationException(Res.GetString(Res.XmlElementHasNoName, parentType.Name, parentType.Namespace));
            }
            TypeMapping mapping = ImportElementType(element, ns);
            ElementAccessor accessor = new ElementAccessor();
            accessor.IsSoap = true;
            accessor.Name = element.Name;
            accessor.Namespace = ns;
            accessor.Mapping = mapping;
            accessor.IsNullable = element.IsNillable;
            accessor.Form = XmlSchemaForm.None;

            return accessor;
        }