System.Xml.Serialization.XmlSchemaExporter.AddSchemaItem C# (CSharp) Method

AddSchemaItem() private method

private AddSchemaItem ( XmlSchemaObject item, string ns, string referencingNs ) : void
item System.Xml.Schema.XmlSchemaObject
ns string
referencingNs string
return void
        private void AddSchemaItem(XmlSchemaObject item, string ns, string referencingNs)
        {
            XmlSchema schema = _schemas[ns];
            if (schema == null)
            {
                schema = AddSchema(ns);
            }

            if (item is XmlSchemaElement)
            {
                XmlSchemaElement e = (XmlSchemaElement)item;
                if (e.Form == XmlSchemaForm.Unqualified)
                    throw new InvalidOperationException(SR.Format(SR.XmlIllegalForm, e.Name));
                e.Form = XmlSchemaForm.None;
            }
            else if (item is XmlSchemaAttribute)
            {
                XmlSchemaAttribute a = (XmlSchemaAttribute)item;
                if (a.Form == XmlSchemaForm.Unqualified)
                    throw new InvalidOperationException(SR.Format(SR.XmlIllegalForm, a.Name));
                a.Form = XmlSchemaForm.None;
            }
            schema.Items.Add(item);
            AddSchemaImport(ns, referencingNs);
        }