Package ca.uhn.fhir.model.primitive
Class XhtmlDt
- All Implemented Interfaces:
IDatatype
,IElement
,IIdentifiableElement
,IPrimitiveDatatype<String>
,ISupportsUndeclaredExtensions
,Externalizable
,Serializable
,IBase
,IBaseDatatype
,IPrimitiveType<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 the
XmlUtil.parse(String)
and XmlUtil.encode(List)
methods to do so.- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
Subclasses must override to convert a "coerced" value into an encoded one.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
boolean
isEmpty()
protected String
Subclasses must override to convert an encoded representation of this datatype into a "coerced" onestatic 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.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 Details
-
DIV_OPEN_FIRST
- See Also:
-
-
Constructor Details
-
XhtmlDt
public XhtmlDt()Constructor -
XhtmlDt
Constructor which accepts a string code- See Also:
-
-
Method Details
-
encode
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
-
isEmpty
- Specified by:
isEmpty
in interfaceIBase
- Overrides:
isEmpty
in classBasePrimitive<String>
-
parse
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
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
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
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
-