Example #1
0
        private static XmlSchemaSet compileValidationSchemas()
        {
            var resolver = ZipArtifactSource.CreateValidationSource();

            XmlSchemaSet schemas = new XmlSchemaSet();

            foreach (var schemaName in minimalSchemas)
            {
                using (var schema = resolver.LoadArtifactByName(schemaName))
                {
                    if (schema == null)
                    {
                        throw new FileNotFoundException("Cannot find manifest resources that represent the minimal set of schemas required for validation");
                    }

                    schemas.Add(null, XmlReader.Create(schema));   // null = use schema namespace as specified in schema file
                }
            }

            schemas.Compile();

            return(schemas);
        }
Example #2
0
        /// <summary>
        /// Creates a default offline cached ArtifactResolver
        /// Default only searches in the executable directory files and the core zip.
        /// </summary>
        public static ArtifactResolver CreateOffline()
        {
            // Making requests to a WebArtifactSource is time consuming. So for performance we have an Offline Resolver.
            IArtifactSource multi = new MultiArtifactSource(new FileDirectoryArtifactSource(true), ZipArtifactSource.CreateValidationSource());

            return(new ArtifactResolver(new CachedArtifactSource(multi)));
        }
Example #3
0
 /// <summary>
 /// Creates a default non-cached ArtifactResolver
 /// Default only searches in the executable directory files and the core zip.
 /// This non-cached resolver is primary for testing purposes.
 /// </summary>
 public static ArtifactResolver CreateDefault()
 {
     return(new ArtifactResolver(new MultiArtifactSource(new FileDirectoryArtifactSource(true), ZipArtifactSource.CreateValidationSource(), new WebArtifactSource())));
 }