public static IEnumerable <IFluentPathElement> Descendants(this IFluentPathElement element)
        {
            //TODO: Don't think this is performant with these nested yields
            foreach (var child in element.Children())
            {
                yield return(child.Child);

                foreach (var grandchild in child.Child.Descendants())
                {
                    yield return(grandchild);
                }
            }
        }
        public static IEnumerable <IFluentPathElement> Children(this IFluentPathElement element, string name)
        {
            var result = element.Children().Where(c => c.IsMatch(name)).Select(c => c.Child);

            // If we are at a resource, we should match a path that is possibly not rooted in the resource
            // (e.g. doing "name.family" on a Patient is equivalent to "Patient.name.family")
            if (!result.Any())
            {
                var resourceRoot = element.Children().SingleOrDefault(node => Char.IsUpper(node.Name[0]));
                if (resourceRoot != null)
                {
                    result = resourceRoot.Child.Children(name);
                }
            }

            return(result);
        }
Exemple #3
0
 public FhirEvaluationContext(FhirClient client, IFluentPathElement originalResource)
 {
     FhirClient       = client;
     OriginalResource = originalResource;
 }
Exemple #4
0
 public FhirEvaluationContext(IFluentPathElement originalResource) : this(null, originalResource)
 {
 }
 public ChildNode(string name, IFluentPathElement child)
 {
     Name  = name;
     Child = child;
 }