fix heirarchy for XhtmlType

This commit is contained in:
Grahame Grieve 2020-08-06 07:37:20 +10:00
parent dd48811c86
commit b4a65d1825
2 changed files with 17 additions and 8 deletions

View File

@ -523,7 +523,7 @@ public class TypeConvertor {
if (b instanceof Element) { if (b instanceof Element) {
return ((Element) b).getXhtml(); return ((Element) b).getXhtml();
} else if (b instanceof XhtmlType) { } else if (b instanceof XhtmlType) {
return ((XhtmlType) b).getValue(); return ((XhtmlType) b).getXhtml();
} else if (b instanceof StringType) { } else if (b instanceof StringType) {
try { try {
return new XhtmlParser().parseFragment(((StringType) b).asStringValue()); return new XhtmlParser().parseFragment(((StringType) b).asStringValue());
@ -539,7 +539,7 @@ public class TypeConvertor {
return ((Element) b).getValue(); return ((Element) b).getValue();
} else if (b instanceof XhtmlType) { } else if (b instanceof XhtmlType) {
try { try {
return new XhtmlComposer(true).compose(((XhtmlType) b).getValue()); return new XhtmlComposer(true).compose(((XhtmlType) b).getXhtml());
} catch (IOException e) { } catch (IOException e) {
return null; return null;
} }

View File

@ -40,7 +40,7 @@ import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; import org.hl7.fhir.utilities.xhtml.XhtmlNode;
public class XhtmlType extends Element { public class XhtmlType extends PrimitiveType<String> {
private Narrative place; private Narrative place;
@ -72,11 +72,15 @@ public class XhtmlType extends Element {
} }
@Override @Override
public Element copy() { public PrimitiveType<String> copy() {
return null; return null;
} }
public XhtmlNode getValue() { public String getValue() {
return primitiveValue();
}
public XhtmlNode getXhtml() {
return place == null ? new XhtmlNode(NodeType.Element, "div") : place.getDiv(); return place == null ? new XhtmlNode(NodeType.Element, "div") : place.getDiv();
} }
@ -104,7 +108,7 @@ public class XhtmlType extends Element {
@Override @Override
public String primitiveValue() { public String primitiveValue() {
try { try {
return new XhtmlComposer(false).compose(getValue()); return new XhtmlComposer(false).compose(getXhtml());
} catch (IOException e) { } catch (IOException e) {
} }
return null; return null;
@ -121,8 +125,13 @@ public class XhtmlType extends Element {
} }
@Override @Override
public XhtmlNode getXhtml() { protected String encode(String theValue) {
return getValue(); return theValue;
}
@Override
protected String parse(String theValue) {
return theValue;
} }