Exemplo n.º 1
0
        // This is the one and only main entry point for all external validation calls (i.e. invoked by the user of the API)
        internal OperationOutcome Validate(IElementNavigator instance, string declaredTypeProfile, IEnumerable <string> statedCanonicals, IEnumerable <StructureDefinition> statedProfiles)
        {
            if (!(instance is ScopedNavigator))
            {
                instance = new ScopedNavigator(instance);
            }

            var processor = new ProfilePreprocessor(profileResolutionNeeded, snapshotGenerationNeeded, instance, declaredTypeProfile, statedProfiles, statedCanonicals);
            var outcome   = processor.Process();

            // Note: only start validating if the profiles are complete and consistent
            if (outcome.Success)
            {
                outcome.Add(Validate((ScopedNavigator)instance, processor.Result));
            }

            return(outcome);

            StructureDefinition profileResolutionNeeded(string canonical)
            {
                if (Settings.ResourceResolver != null)
                {
                    return(Settings.ResourceResolver.FindStructureDefinition(canonical));
                }
                else
                {
                    return(null);
                }
            }
        }
Exemplo n.º 2
0
        // This is the one and only main entry point for all external validation calls (i.e. invoked by the user of the API)
        internal OperationOutcome Validate(IElementNavigator instance, string declaredTypeProfile, IEnumerable <string> statedCanonicals, IEnumerable <StructureDefinition> statedProfiles)
        {
            var processor = new ProfilePreprocessor(profileResolutionNeeded, snapshotGenerationNeeded, instance, declaredTypeProfile, statedProfiles, statedCanonicals);
            var outcome   = processor.Process();

            // Note: only start validating if the profiles are complete and consistent
            if (outcome.Success)
            {
                outcome.Add(Validate(instance, processor.Result));
            }

            return(outcome);
        }