
Package ca.uhn.fhir.model.primitive
Class XhtmlDt
- java.lang.Object
-
- ca.uhn.fhir.model.api.BaseElement
-
- ca.uhn.fhir.model.api.BaseIdentifiableElement
-
- ca.uhn.fhir.model.api.BasePrimitive<String>
-
- ca.uhn.fhir.model.primitive.XhtmlDt
-
- All Implemented Interfaces:
IDatatype
,IElement
,IIdentifiableElement
,IPrimitiveDatatype<String>
,ISupportsUndeclaredExtensions
,Externalizable
,Serializable
,IBase
,IBaseDatatype
,IPrimitiveType<String>
public class XhtmlDt extends BasePrimitive<String>
Note that as of HAPI FHIR 3.1.0, this method no longer uses the StAX XMLEvent type as the XML representation, and uses a String instead. If you need to work with XML as StAX events, you can use theXmlUtil.parse(String)
andXmlUtil.encode(List)
methods to do so.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
DIV_OPEN_FIRST
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
encode(String theValue)
Subclasses must override to convert a "coerced" value into an encoded one.String
getValue()
Note that as of HAPI FHIR 3.1.0, this method no longer uses the StAX XMLEvent type as the XML representation, and uses a String instead.boolean
hasContent()
boolean
isEmpty()
protected String
parse(String theValue)
Subclasses must override to convert an encoded representation of this datatype into a "coerced" onestatic String
preprocessXhtmlNamespaceDeclaration(String value)
BasePrimitive<String>
setValue(String theValue)
Note that as of HAPI FHIR 3.1.0, this method no longer uses the StAX XMLEvent type as the XML representation, and uses a String instead.void
setValueAsString(String theValue)
Accepts a textual DIV and parses it into XHTML events which are stored internally.-
Methods inherited from class ca.uhn.fhir.model.api.BasePrimitive
equals, getValueAsString, hashCode, hasValue, readExternal, toString, updateStringValue, writeExternal
-
Methods inherited from class ca.uhn.fhir.model.api.BaseIdentifiableElement
getElementSpecificId, getId, setElementSpecificId, setId, setId
-
Methods inherited from class ca.uhn.fhir.model.api.BaseElement
addUndeclaredExtension, addUndeclaredExtension, addUndeclaredExtension, getAllUndeclaredExtensions, getFormatCommentsPost, getFormatCommentsPre, getUndeclaredExtensions, getUndeclaredExtensionsByUrl, getUndeclaredModifierExtensions, getUserData, hasFormatComment, isBaseEmpty, setUserData
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hl7.fhir.instance.model.api.IBase
fhirType, getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserData
-
-
-
-
Field Detail
-
DIV_OPEN_FIRST
public static final String DIV_OPEN_FIRST
- See Also:
- Constant Field Values
-
-
Method Detail
-
encode
protected String encode(String theValue)
Description copied from class:BasePrimitive
Subclasses must override to convert a "coerced" value into an encoded one.- Specified by:
encode
in classBasePrimitive<String>
- Parameters:
theValue
- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
hasContent
public boolean hasContent()
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceIBase
- Overrides:
isEmpty
in classBasePrimitive<String>
-
parse
protected String parse(String theValue)
Description copied from class:BasePrimitive
Subclasses must override to convert an encoded representation of this datatype into a "coerced" one- Specified by:
parse
in classBasePrimitive<String>
- Parameters:
theValue
- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
getValue
public String getValue()
Note that as of HAPI FHIR 3.1.0, this method no longer uses the StAX XMLEvent type as the XML representation, and uses a String instead. If you need to work with XML as StAX events, you can use theXmlUtil.parse(String)
andXmlUtil.encode(List)
methods to do so.- Specified by:
getValue
in interfaceIPrimitiveDatatype<String>
- Specified by:
getValue
in interfaceIPrimitiveType<String>
- Overrides:
getValue
in classBasePrimitive<String>
-
setValue
public BasePrimitive<String> setValue(String theValue) throws DataFormatException
Note that as of HAPI FHIR 3.1.0, this method no longer uses the StAX XMLEvent type as the XML representation, and uses a String instead. If you need to work with XML as StAX events, you can use theXmlUtil.parse(String)
andXmlUtil.encode(List)
methods to do so.- Specified by:
setValue
in interfaceIPrimitiveDatatype<String>
- Specified by:
setValue
in interfaceIPrimitiveType<String>
- Overrides:
setValue
in classBasePrimitive<String>
- Throws:
DataFormatException
-
setValueAsString
public void setValueAsString(String theValue) throws DataFormatException
Accepts a textual DIV and parses it into XHTML events which are stored internally.Formatting note: The text will be trimmed
String.trim()
. If the text does not start with an HTML tag (generally this would be a div tag), a div tag will be automatically placed surrounding the text.Also note that if the parsed text contains any entities (&foo;) which are not a part of the entities defined in core XML (e.g. § which is valid in XHTML 1.0 but not in XML 1.0) they will be parsed and converted to their equivalent unicode character.
- Specified by:
setValueAsString
in interfaceIPrimitiveDatatype<String>
- Specified by:
setValueAsString
in interfaceIPrimitiveType<String>
- Overrides:
setValueAsString
in classBasePrimitive<String>
- Throws:
DataFormatException
-
preprocessXhtmlNamespaceDeclaration
public static String preprocessXhtmlNamespaceDeclaration(String value)
-
-