From 6ec76df7fc7699f24e646f38cd1d204ab76a9b80 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 12 Feb 2020 17:42:09 +1100 Subject: [PATCH] Fix generator to add both lang and xml:lang per https://www.w3.org/TR/i18n-html-tech-lang/#langvalues + Fix the generator handle Concept Maps with missing tragets --- .../main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java index 4515cc637..0dd6c90d6 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java @@ -2515,6 +2515,8 @@ public class NarrativeGenerator implements INarrativeGenerator { if (!x.hasAttribute("xmlns")) x.setAttribute("xmlns", "http://www.w3.org/1999/xhtml"); if (r.hasLanguage()) { + // use both - see https://www.w3.org/TR/i18n-html-tech-lang/#langvalues + x.setAttribute("lang", r.getLanguage()); x.setAttribute("xml:lang", r.getLanguage()); } if (!r.hasText() || !r.getText().hasDiv() || r.getText().getDiv().getChildNodes().isEmpty()) { @@ -2919,6 +2921,9 @@ public class NarrativeGenerator implements INarrativeGenerator { } private ConceptMapRenderInstructions findByTarget(DataType source) { + if (source == null) { + return null; + } String src = source.primitiveValue(); if (src != null) for (ConceptMapRenderInstructions t : renderingMaps) {