private void AddAncestorDefinition(StructureDefinition structureDefinition, IStructureDefinitionResolver resolver)
        {
            if (structureDefinition == null)
            {
                return;
            }

            if (structureDefinition.@base == null)
            {
                return;
            }

            if (String.IsNullOrWhiteSpace([email protected]))
            {
                return;
            }

            StructureDefinition baseStructureDefinition = resolver.GetStructureDefinition([email protected]);

            if (baseStructureDefinition == null)
            {
                return;
            }

            if (baseStructureDefinition == structureDefinition)
            {
                return;
            }

            _ancestors.Add(baseStructureDefinition);

            AddAncestorDefinition(baseStructureDefinition, resolver);
        }
Example #2
0
        public void AddExtensionDefinitions(SDTreeNode treeNode, IStructureDefinitionResolver resolver)
        {
            if (!treeNode.GetNodeType().IsExtension())
            {
                return;
            }

            ElementDefinitionType[] type = treeNode.GetElementDefinitionType();

            if (type == null)
            {
                return;
            }

            if (type.Length != 1)
            {
                return;
            }

            if (type.First().profile == null)
            {
                return;
            }

            if (type.First().profile.Length != 1)
            {
                return;
            }

            uri profileUri = type.First().profile.First();

            if (profileUri == null)
            {
                return;
            }

            StructureDefinition structureDefinition = resolver.GetStructureDefinition(profileUri.value);

            if (structureDefinition == null)
            {
                throw new Exception("Could not find extension " + profileUri.value);
            }

            treeNode.ExtensionDefinition = structureDefinition;
        }