From 98ba40748e5b414bf1dd85dff58944ea1d848017 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sat, 19 Feb 2022 21:46:05 +1100 Subject: [PATCH] Follow content reference when rendering XML resources --- .../fhir/r5/conformance/ProfileUtilities.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java index 3db5f1d77..26aeb35e0 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java @@ -553,7 +553,17 @@ public class ProfileUtilities extends TranslatingUtilities { } public List getChildList(StructureDefinition structure, ElementDefinition element) { - return getChildList(structure, element.getPath(), element.getId(), false); + if (element.hasContentReference()) { + ElementDefinition target = element; + for (ElementDefinition t : structure.getSnapshot().getElement()) { + if (t.getId().equals(element.getContentReference().substring(1))) { + target = t; + } + } + return getChildList(structure, target.getPath(), target.getId(), false); + } else { + return getChildList(structure, element.getPath(), element.getId(), false); + } } public void updateMaps(StructureDefinition base, StructureDefinition derived) throws DefinitionException { @@ -3680,7 +3690,7 @@ public class ProfileUtilities extends TranslatingUtilities { } - private String codeForAggregation(AggregationMode a) { + public static String codeForAggregation(AggregationMode a) { switch (a) { case BUNDLED : return "b"; case CONTAINED : return "c"; @@ -3689,7 +3699,7 @@ public class ProfileUtilities extends TranslatingUtilities { } } - private String hintForAggregation(AggregationMode a) { + public static String hintForAggregation(AggregationMode a) { if (a != null) return a.getDefinition(); else