Example #1
0
        private static XmlSchemaTypeCollection GetTypeCollection(XmlSchemaTypeLoader typeLoader, string schemaNamespace)
        {
            XmlSchemaTypeCollection typeCollection;

            if (schemaNamespace != "")
            {
                typeCollection = typeLoader.GetTypeCollection(schemaNamespace);
            }
            else
            {
                IEnumerable <XmlSchemaTypeCollection> collections = typeLoader.GetTypeCollections();
                typeCollection = collections.First();
            }
            if (typeCollection == null)
            {
                throw new InvalidOperationException(string.Format("schema namespace '{0}' is missing or has no types", schemaNamespace));
            }
            return(typeCollection);
        }