System.Runtime.Serialization.SchemaHelper.GetSchema C# (CSharp) Method

GetSchema() static private method

static private GetSchema ( string ns, XmlSchemaSet schemas ) : XmlSchema
ns string
schemas System.Xml.Schema.XmlSchemaSet
return System.Xml.Schema.XmlSchema
        internal static XmlSchema GetSchema(string ns, XmlSchemaSet schemas)
        {
            if (ns == null) { ns = String.Empty; }

            ICollection currentSchemas = schemas.Schemas();
            foreach (XmlSchema schema in currentSchemas)
            {
                if ((schema.TargetNamespace == null && ns.Length == 0) || ns.Equals(schema.TargetNamespace))
                {
                    return schema;
                }
            }
            return CreateSchema(ns, schemas);
        }

Usage Example

Esempio n. 1
0
        internal static void AddDefaultXmlType(XmlSchemaSet schemas, string localName, string ns)
        {
            XmlSchemaComplexType defaultXmlType = CreateAnyType();

            defaultXmlType.Name = localName;
            XmlSchema schema = SchemaHelper.GetSchema(ns, schemas);

            schema.Items.Add(defaultXmlType);
            schemas.Reprocess(schema);
        }
All Usage Examples Of System.Runtime.Serialization.SchemaHelper::GetSchema