ca.uhn.fhir.model.primitive.XhtmlDt类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中ca.uhn.fhir.model.primitive.XhtmlDt类的一些代码示例,展示了XhtmlDt类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XhtmlDt类的具体详情如下:
包路径:ca.uhn.fhir.model.primitive.XhtmlDt
类名称:XhtmlDt

XhtmlDt介绍

[英]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.
[中]请注意,从HAPI FHIR 3.1.0开始,此方法不再使用StAX XMLEvent类型作为XML表示,而是使用字符串。如果需要将XML用作StAX事件,可以使用XmlUtil#parse(String)和XmlUtil#encode(List)方法。

代码示例

代码示例来源:origin: jamesagnew/hapi-fhir

  1. /**
  2. * Sets the value using a textual DIV (or simple text block which will be
  3. * converted to XHTML)
  4. */
  5. public void setDiv(String theTextDiv) {
  6. myDiv = new XhtmlDt(theTextDiv);
  7. }

代码示例来源:origin: jamesagnew/hapi-fhir

  1. @Override
  2. public String getDivAsString() {
  3. return getDiv().getValueAsString();
  4. }

代码示例来源:origin: jamesagnew/hapi-fhir

  1. public boolean hasContent() {
  2. return isNotBlank(getValue());
  3. }

代码示例来源:origin: jamesagnew/hapi-fhir

  1. if (dt.hasContent()) {
  2. encodeXhtml(dt, theEventWriter);
  3. if (!dt.isEmpty()) {
  4. XhtmlDt hdt = new XhtmlDt();
  5. hdt.setValueAsString(dt.getValueAsString());
  6. encodeXhtml(hdt, theEventWriter);

代码示例来源:origin: jamesagnew/hapi-fhir

  1. /**
  2. * Accepts a textual DIV and parses it into XHTML events which are stored internally.
  3. * <p>
  4. * <b>Formatting note:</b> The text will be trimmed {@link 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
  5. * surrounding the text.
  6. * </p>
  7. * <p>
  8. * Also note that if the parsed text contains any entities (&amp;foo;) which are not a part of the entities defined in core XML (e.g. &amp;sect; which is valid in XHTML 1.0 but not in XML 1.0) they
  9. * will be parsed and converted to their equivalent unicode character.
  10. * </p>
  11. */
  12. @Override
  13. public void setValueAsString(String theValue) throws DataFormatException {
  14. if (theValue == null || theValue.isEmpty()) {
  15. super.setValueAsString(null);
  16. } else {
  17. String value = theValue.trim();
  18. value = preprocessXhtmlNamespaceDeclaration(value);
  19. super.setValueAsString(value);
  20. }
  21. }

代码示例来源:origin: jamesagnew/hapi-fhir

  1. @Override
  2. public void setDivAsString(String theString) {
  3. getDiv().setValueAsString(theString);
  4. }

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-base

  1. if (dt.hasContent()) {
  2. encodeXhtml(dt, theEventWriter);
  3. if (!dt.isEmpty()) {
  4. XhtmlDt hdt = new XhtmlDt();
  5. hdt.setValueAsString(dt.getValueAsString());
  6. encodeXhtml(hdt, theEventWriter);

代码示例来源:origin: jamesagnew/hapi-fhir

  1. val = XhtmlDt.preprocessXhtmlNamespaceDeclaration(val);

代码示例来源:origin: jamesagnew/hapi-fhir

  1. /**
  2. * Constructor which accepts a string code
  3. *
  4. * @see #setValueAsString(String) for a description of how this value is applied
  5. */
  6. @SimpleSetter()
  7. public XhtmlDt(@SimpleSetter.Parameter(name = "theTextDiv") String theTextDiv) {
  8. setValueAsString(theTextDiv);
  9. }

代码示例来源:origin: jamesagnew/hapi-fhir

  1. /**
  2. * Gets the value(s) for <b>div</b> (Limited xhtml content).
  3. * creating it if it does
  4. * not exist. Will not return <code>null</code>.
  5. *
  6. * <p>
  7. * <b>Definition:</b>
  8. * The actual narrative content, a stripped down version of XHTML
  9. * </p>
  10. */
  11. public XhtmlDt getDiv() {
  12. if (myDiv == null) {
  13. myDiv = new XhtmlDt();
  14. }
  15. return myDiv;
  16. }

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-base

  1. @Override
  2. public String getDivAsString() {
  3. return getDiv().getValueAsString();
  4. }

代码示例来源:origin: jamesagnew/hapi-fhir

  1. @Override
  2. public boolean isEmpty() {
  3. return super.isBaseEmpty() && (getValue() == null || getValue().isEmpty());
  4. }

代码示例来源:origin: jamesagnew/hapi-fhir

  1. @Override
  2. public String getValueAsString() {
  3. if (isEmpty()) {
  4. return null;
  5. }
  6. try {
  7. String retVal = new XhtmlComposer(XhtmlComposer.HTML).compose(this);
  8. retVal = XhtmlDt.preprocessXhtmlNamespaceDeclaration(retVal);
  9. return retVal;
  10. } catch (Exception e) {
  11. // TODO: composer shouldn't throw exception like this
  12. throw new RuntimeException(e);
  13. }
  14. }

代码示例来源:origin: jamesagnew/hapi-fhir

  1. ((IResource) input).getText().getDiv().setValueAsString((String) null);
  2. ((IResource) input).getText().getStatus().setValueAsString((String) null);
  3. if (input instanceof Bundle) {
  4. for (Entry nextEntry : ((Bundle) input).getEntry()) {
  5. if (nextEntry.getResource() != null) {
  6. nextEntry.getResource().getText().getDiv().setValueAsString((String) null);
  7. nextEntry.getResource().getText().getStatus().setValueAsString((String) null);

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-structures-dstu2

  1. /**
  2. * Sets the value using a textual DIV (or simple text block which will be
  3. * converted to XHTML)
  4. */
  5. public void setDiv(String theTextDiv) {
  6. myDiv = new XhtmlDt(theTextDiv);
  7. }

代码示例来源:origin: jamesagnew/hapi-fhir

  1. writer.append(((IResource) theResource).getText().getDiv().getValueAsString());
  2. } else if (encodingDomainResourceAsText && theResource instanceof IDomainResource) {

代码示例来源:origin: jamesagnew/hapi-fhir

  1. private void encodeXhtml(XhtmlDt theDt, XMLStreamWriter theEventWriter) throws XMLStreamException {
  2. if (theDt == null || theDt.getValue() == null) {
  3. return;
  4. List<XMLEvent> events = XmlUtil.parse(theDt.getValue());
  5. boolean firstElement = true;

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-base

  1. /**
  2. * Accepts a textual DIV and parses it into XHTML events which are stored internally.
  3. * <p>
  4. * <b>Formatting note:</b> The text will be trimmed {@link 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
  5. * surrounding the text.
  6. * </p>
  7. * <p>
  8. * Also note that if the parsed text contains any entities (&amp;foo;) which are not a part of the entities defined in core XML (e.g. &amp;sect; which is valid in XHTML 1.0 but not in XML 1.0) they
  9. * will be parsed and converted to their equivalent unicode character.
  10. * </p>
  11. */
  12. @Override
  13. public void setValueAsString(String theValue) throws DataFormatException {
  14. if (theValue == null || theValue.isEmpty()) {
  15. super.setValueAsString(null);
  16. } else {
  17. String value = theValue.trim();
  18. value = preprocessXhtmlNamespaceDeclaration(value);
  19. super.setValueAsString(value);
  20. }
  21. }

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-base

  1. @Override
  2. public void setDivAsString(String theString) {
  3. getDiv().setValueAsString(theString);
  4. }

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-structures-dstu

  1. /**
  2. * Sets the value using a textual DIV (or simple text block which will be
  3. * converted to XHTML)
  4. */
  5. public void setDiv(String theTextDiv) {
  6. myDiv = new XhtmlDt(theTextDiv);
  7. }

相关文章