From cdef76bc6d4cbc12763307ba5ceefe7d66af2935 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 7 Apr 2022 00:20:11 +1000 Subject: [PATCH] Fix bug where expansions have empty onbjects --- .../java/org/hl7/fhir/r4/formats/XmlParserBase.java | 3 ++- .../fhir/r5/terminologies/ValueSetExpanderSimple.java | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/XmlParserBase.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/XmlParserBase.java index b64f03635..f0e87de9e 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/XmlParserBase.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/formats/XmlParserBase.java @@ -320,8 +320,9 @@ public abstract class XmlParserBase extends ParserBase implements IParser { protected void unknownContent(XmlPullParser xpp) throws FHIRFormatError, XmlPullParserException, IOException { - if (!isAllowUnknownContent()) + if (!isAllowUnknownContent()) { throw new FHIRFormatError("Unknown Content "+xpp.getName()+" @ "+pathForLocation(xpp)); + } // otherwise, read over whatever element this is int count = 1; do { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java index 20733db59..538e66b64 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetExpanderSimple.java @@ -225,7 +225,15 @@ public class ValueSetExpanderSimple extends ValueSetWorker implements ValueSetEx if (expParams.getParameterBool("includeDesignations") && designations != null) { for (ConceptDefinitionDesignationComponent t : designations) { - ToolingExtensions.addLanguageTranslation(n, t.getLanguage(), t.getValue()); + if (t.getLanguage() != null || t.getValue() != null) { + ConceptReferenceDesignationComponent d = n.addDesignation(); + if (t.getLanguage() != null) { + d.setLanguage(t.getLanguage().trim()); + } + if (t.getValue() != null) { + d.setValue(t.getValue().trim()); + } + } } } ConceptDefinitionDesignationComponent t = expParams.hasLanguage() ? getMatchingLang(designations, expParams.getLanguage()) : null;