From b4a65d1825d52618d97e2441bd7f1bd049d17ab3 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 6 Aug 2020 07:37:20 +1000 Subject: [PATCH] fix heirarchy for XhtmlType --- .../org/hl7/fhir/r5/model/TypeConvertor.java | 4 ++-- .../java/org/hl7/fhir/r5/model/XhtmlType.java | 21 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/TypeConvertor.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/TypeConvertor.java index 77c134bfe..5bff8b779 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/TypeConvertor.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/TypeConvertor.java @@ -523,7 +523,7 @@ public class TypeConvertor { if (b instanceof Element) { return ((Element) b).getXhtml(); } else if (b instanceof XhtmlType) { - return ((XhtmlType) b).getValue(); + return ((XhtmlType) b).getXhtml(); } else if (b instanceof StringType) { try { return new XhtmlParser().parseFragment(((StringType) b).asStringValue()); @@ -539,7 +539,7 @@ public class TypeConvertor { return ((Element) b).getValue(); } else if (b instanceof XhtmlType) { try { - return new XhtmlComposer(true).compose(((XhtmlType) b).getValue()); + return new XhtmlComposer(true).compose(((XhtmlType) b).getXhtml()); } catch (IOException e) { return null; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/XhtmlType.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/XhtmlType.java index 8d3534655..d2fba56d9 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/XhtmlType.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/XhtmlType.java @@ -40,7 +40,7 @@ import org.hl7.fhir.utilities.xhtml.XhtmlComposer; import org.hl7.fhir.utilities.xhtml.XhtmlNode; -public class XhtmlType extends Element { +public class XhtmlType extends PrimitiveType { private Narrative place; @@ -72,11 +72,15 @@ public class XhtmlType extends Element { } @Override - public Element copy() { + public PrimitiveType copy() { return null; } - public XhtmlNode getValue() { + public String getValue() { + return primitiveValue(); + } + + public XhtmlNode getXhtml() { return place == null ? new XhtmlNode(NodeType.Element, "div") : place.getDiv(); } @@ -104,7 +108,7 @@ public class XhtmlType extends Element { @Override public String primitiveValue() { try { - return new XhtmlComposer(false).compose(getValue()); + return new XhtmlComposer(false).compose(getXhtml()); } catch (IOException e) { } return null; @@ -121,8 +125,13 @@ public class XhtmlType extends Element { } @Override - public XhtmlNode getXhtml() { - return getValue(); + protected String encode(String theValue) { + return theValue; + } + + @Override + protected String parse(String theValue) { + return theValue; }