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) {
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;
}

View File

@ -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<String> {
private Narrative place;
@ -72,11 +72,15 @@ public class XhtmlType extends Element {
}
@Override
public Element copy() {
public PrimitiveType<String> 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;
}