Esempio n. 1
0
        private static XmlSchemaSet compileValidationSchemas()
        {
            var resolver = new CoreZipArtifactSource();

            XmlSchemaSet schemas = new XmlSchemaSet();

            foreach(var schemaName in minimalSchemas)
            {
                using (var schema = resolver.ReadContentArtifact(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
                    schema.Dispose();
                }
            }

            schemas.Compile();

            return schemas;
        }
Esempio n. 2
0
        private static XmlSchemaSet compileValidationSchemas()
        {
            var resolver = new CoreZipArtifactSource();

            XmlSchemaSet schemas = new XmlSchemaSet();

            foreach (var schemaName in minimalSchemas)
            {
                using (var schema = resolver.ReadContentArtifact(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
                    schema.Dispose();
                }
            }

            schemas.Compile();

            return(schemas);
        }
        public void RecreatingCoreZipArtifact()
        {
            var fa = new CoreZipArtifactSource();

            fa.Prepare(); // First time might be expensive...

            Stopwatch sw = new Stopwatch();

            for (var loop = 0; loop < 50; loop++)
            {
                fa = new CoreZipArtifactSource();
                fa.Prepare();
            }

            sw.Stop();

            Assert.IsTrue(sw.ElapsedMilliseconds < 20 * 50);
        }
        public void GetSomeArtifactsById()
        {
            var fa = new CoreZipArtifactSource();

            var vs = fa.ReadResourceArtifact(new Uri("http://hl7.org/fhir/v2/vs/0292"));
            Assert.IsNotNull(vs);
            Assert.IsTrue(vs is ValueSet);

            vs = fa.ReadResourceArtifact(new Uri("http://hl7.org/fhir/vs/location-status"));
            Assert.IsNotNull(vs);
            Assert.IsTrue(vs is ValueSet);

            var rs = fa.ReadResourceArtifact(new Uri("http://hl7.org/fhir/Profile/Condition"));
            Assert.IsNotNull(rs);
            Assert.IsTrue(rs is Profile);

            rs = fa.ReadResourceArtifact(new Uri("http://hl7.org/fhir/Profile/ValueSet"));
            Assert.IsNotNull(rs);
            Assert.IsTrue(rs is Profile);

            var dt = fa.ReadResourceArtifact(new Uri("http://hl7.org/fhir/Profile/Money"));
            Assert.IsNotNull(rs);
            Assert.IsTrue(dt is Profile);
        }
        public void GetSomeBundledArtifacts()
        {
            var za = new CoreZipArtifactSource();
            za.Prepare();

            using (var a = za.ReadContentArtifact("patient.sch"))
            {
                Assert.IsNotNull(a);
            }

            using (var a = za.ReadContentArtifact("core-valuesets-v3.xml"))
            {
                Assert.IsNotNull(a);
            }

            using (var a = za.ReadContentArtifact("patient.xsd"))
            {
                Assert.IsNotNull(a);
            }
        }