• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XhtmlNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.hl7.fhir.utilities.xhtml.XhtmlNode的典型用法代码示例。如果您正苦于以下问题:Java XhtmlNode类的具体用法?Java XhtmlNode怎么用?Java XhtmlNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XhtmlNode类属于org.hl7.fhir.utilities.xhtml包,在下文中一共展示了XhtmlNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testParseEmptyNarrative

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
@Test
public void testParseEmptyNarrative() throws Exception {
	//@formatter:off
	String text = "{\n" + 
			"    \"resourceType\" : \"Patient\",\n" + 
			"    \"extension\" : [\n" + 
			"      {\n" + 
			"        \"url\" : \"http://clairol.org/colour\",\n" + 
			"        \"valueCode\" : \"B\"\n" + 
			"      }\n" + 
			"    ],\n" + 
			"    \"text\" : {\n" + 
			"      \"div\" : \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"\n" + 
			"    }" + 
			"}";
	//@formatter:on

	Patient res = (Patient) ourCtx.newJsonParser().parseResource(text);
	XhtmlNode div = res.getText().getDiv();
	String value = div.getValueAsString();

	assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", value);
	assertTrue(div.getChildNodes().isEmpty());
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:25,代码来源:JsonParserTest.java


示例2: composeXhtml

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
protected void composeXhtml(String name, XhtmlNode html) throws IOException {
	if (!Utilities.noString(xhtmlMessage)) {
		xml.enter(XhtmlComposer.XHTML_NS, name);
		xml.comment(xhtmlMessage, false);
		xml.exit(XhtmlComposer.XHTML_NS, name);
	} else {
		XhtmlComposer comp = new XhtmlComposer(XhtmlComposer.XML, htmlPretty);
		// name is also found in the html and should the same
		// ? check that
		boolean oldPretty = xml.isPretty();
		xml.setPretty(htmlPretty);
		if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null)
			xml.namespace(XhtmlComposer.XHTML_NS, null);
		comp.compose(xml, html);
		xml.setPretty(oldPretty);
	}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:18,代码来源:XmlParserBase.java


示例3: renderSections

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
private void renderSections(Bundle feed, XhtmlNode node, List<SectionComponent> sections, int level) {
    for (SectionComponent section : sections) {
      node.hr();
      if (section.hasTitleElement())
        node.addTag("h"+Integer.toString(level)).addText(section.getTitle());
//      else if (section.hasCode())
//        node.addTag("h"+Integer.toString(level)).addText(displayCodeableConcept(section.getCode()));

//      if (section.hasText()) {
//        node.getChildNodes().add(section.getText().getDiv());
//      }
//
//      if (!section.getSection().isEmpty()) {
//        renderSections(feed, node.addTag("blockquote"), section.getSection(), level+1);
//      }
    }
  }
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:18,代码来源:NarrativeGenerator.java


示例4: analyseRule

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
private void analyseRule(String indent, TransformContext context, StructureMap map, VariablesForProfiling vars, StructureMapGroupComponent group, StructureMapGroupRuleComponent rule, StructureMapAnalysis result) throws Exception {
    log(indent+"Analyse rule : "+rule.getName());
    XhtmlNode tr = result.summary.addTag("tr");
    XhtmlNode xs = tr.addTag("td");
    XhtmlNode xt = tr.addTag("td");

    VariablesForProfiling srcVars = vars.copy();
    if (rule.getSource().size() != 1)
      throw new Exception("Rule \""+rule.getName()+"\": not handled yet");
    VariablesForProfiling source = analyseSource(rule.getName(), context, srcVars, rule.getSourceFirstRep(), xs);

    TargetWriter tw = new TargetWriter();
      for (StructureMapGroupRuleTargetComponent t : rule.getTarget()) {
      analyseTarget(rule.getName(), context, source, map, t, rule.getSourceFirstRep().getVariable(), tw, result.profiles, rule.getName());
      }
    tw.commit(xt);

          for (StructureMapGroupRuleComponent childrule : rule.getRule()) {
      analyseRule(indent+"  ", context, map, source, group, childrule, result);
          }
//    for (StructureMapGroupRuleDependentComponent dependent : rule.getDependent()) {
//      executeDependency(indent+"  ", context, map, v, group, dependent); // do we need group here?
//    }
          }
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:StructureMapUtilities.java


示例5: testParseEmptyNarrative

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
@Test
public void testParseEmptyNarrative() throws Exception {
  //@formatter:off
String text = "{\n" + 
		"    \"resourceType\" : \"Patient\",\n" + 
		"    \"extension\" : [\n" + 
		"      {\n" + 
		"        \"url\" : \"http://clairol.org/colour\",\n" + 
		"        \"valueCode\" : \"B\"\n" + 
		"      }\n" + 
		"    ],\n" + 
		"    \"text\" : {\n" + 
		"      \"div\" : \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"\n" + 
		"    }" + 
		"}";
//@formatter:on

  Patient res = (Patient) ourCtx.newJsonParser().parseResource(text);
  XhtmlNode div = res.getText().getDiv();
  String value = div.getValueAsString();

  assertNull(value);
  List<XhtmlNode> childNodes = div.getChildNodes();
  assertTrue(childNodes == null || childNodes.isEmpty());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:26,代码来源:JsonParserHl7OrgDstu2Test.java


示例6: generateDocumentNarrative

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
public XhtmlNode generateDocumentNarrative(Bundle feed) {
  /*
   When the document is presented for human consumption, applications must present the collated narrative portions of the following resources in order:
   * The Composition resource
   * The Subject resource
   * Resources referenced in the section.content
   */
  XhtmlNode root = new XhtmlNode(NodeType.Element, "div");
  Composition comp = (Composition) feed.getEntry().get(0).getResource();
  root.getChildNodes().add(comp.getText().getDiv());
  Resource subject = ResourceUtilities.getById(feed, null, comp.getSubject().getReference());
  if (subject != null && subject instanceof DomainResource) {
    root.hr();
    root.getChildNodes().add(((DomainResource)subject).getText().getDiv());
  }
  List<SectionComponent> sections = comp.getSection();
  renderSections(feed, root, sections, 1);
  return root;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:20,代码来源:NarrativeGenerator.java


示例7: generateTable

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
public XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set<String> outputTracker) throws IOException, FHIRException {
  assert(diff != snapshot);// check it's ok to get rid of one of these
  HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
  gen.setTranslator(getTranslator());
  TableModel model = gen.initNormalTable(corePath, false);
  List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
  List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
  profiles.add(profile);
  if (list.isEmpty())
    throw new FHIRException((diff ? "Differential" : "Snapshot") + " is empty generating heirarchical table for "+profile.getUrl());
  genElement(defFile == null ? null : defFile+"#", gen, model.getRows(), list.get(0), list, profiles, diff, profileBaseFileName, null, snapshot, corePath, imagePath, true, logicalModel, profile.getDerivation() == TypeDerivationRule.CONSTRAINT && usesMustSupport(list), allInvariants);
  try {
    return gen.generate(model, imagePath, 0, outputTracker);
	} catch (org.hl7.fhir.exceptions.FHIRException e) {
		throw new FHIRException(e.getMessage(), e);
	}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:18,代码来源:ProfileUtilities.java


示例8: analyseGroup

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
private void analyseGroup(String indent, TransformContext context, StructureMap map, VariablesForProfiling vars, StructureMapGroupComponent group, StructureMapAnalysis result) throws Exception {
  log(indent+"Analyse Group : "+group.getName());
  // todo: extends
  // todo: check inputs
  XhtmlNode tr = result.summary.addTag("tr").setAttribute("class", "diff-title");
  XhtmlNode xs = tr.addTag("td");
  XhtmlNode xt = tr.addTag("td");
  for (StructureMapGroupInputComponent inp : group.getInput()) {
    if (inp.getMode() == StructureMapInputMode.SOURCE) 
      noteInput(vars, inp, VariableMode.INPUT, xs);
    if (inp.getMode() == StructureMapInputMode.TARGET) 
      noteInput(vars, inp, VariableMode.OUTPUT, xt);
  }
  for (StructureMapGroupRuleComponent r : group.getRule()) {
    analyseRule(indent+"  ", context, map, vars, group, r, result);
  }    
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:18,代码来源:StructureMapUtilities.java


示例9: generate

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
public String generate(ResourceContext rcontext, org.hl7.fhir.r4.elementmodel.Element er, boolean showCodeDetails) throws IOException, DefinitionException {
  if (rcontext == null)
    rcontext = new ResourceContext(null, er);
  
  XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
  x.para().b().tx("Generated Narrative"+(showCodeDetails ? " with Details" : ""));
  try {
    ResurceWrapperMetaElement resw = new ResurceWrapperMetaElement(er);
    BaseWrapperMetaElement base = new BaseWrapperMetaElement(er, null, er.getProperty().getStructure(), er.getProperty().getDefinition());
    base.children();
    generateByProfile(resw, er.getProperty().getStructure(), base, er.getProperty().getStructure().getSnapshot().getElement(), er.getProperty().getDefinition(), base.children, x, er.fhirType(), showCodeDetails);

  } catch (Exception e) {
    e.printStackTrace();
    x.para().b().setAttribute("style", "color: maroon").tx("Exception generating Narrative: "+e.getMessage());
  }
  inject(er, x,  NarrativeStatus.GENERATED);
  return new XhtmlComposer(XhtmlComposer.XML, pretty).compose(x);
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:20,代码来源:NarrativeGenerator.java


示例10: generateDefinition

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
private boolean generateDefinition(XhtmlNode x, CodeSystem cs, boolean header, String lang) throws FHIRFormatError, DefinitionException, IOException {
  boolean hasExtensions = false;

  if (header) {
    XhtmlNode h = x.h2();
    h.addText(cs.hasTitle() ? cs.getTitle() : cs.getName());
    addMarkdown(x, cs.getDescription());
    if (cs.hasCopyright())
      generateCopyright(x, cs, lang);
  }

  generateProperties(x, cs, lang);
  generateFilters(x, cs, lang);
  List<UsedConceptMap> maps = new ArrayList<UsedConceptMap>();
  hasExtensions = generateCodeSystemContent(x, cs, hasExtensions, maps, lang);

  return hasExtensions;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:19,代码来源:NarrativeGenerator.java


示例11: generateProperties

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
private void generateProperties(XhtmlNode x, CodeSystem cs, String lang) {
  if (cs.hasProperty()) {
    x.para().b().tx(context.translator().translate("xhtml-gen-cs", "Properties", lang));
    XhtmlNode tbl = x.table("grid");
    XhtmlNode tr = tbl.tr();
    tr.td().b().tx(context.translator().translate("xhtml-gen-cs", "Code", lang));
    tr.td().b().tx(context.translator().translate("xhtml-gen-cs", "URL", lang));
    tr.td().b().tx(context.translator().translate("xhtml-gen-cs", "Description", lang));
    tr.td().b().tx(context.translator().translate("xhtml-gen-cs", "Type", lang));
    for (PropertyComponent p : cs.getProperty()) {
      tr = tbl.tr();
      tr.td().tx(p.getCode());
      tr.td().tx(p.getUri());
      tr.td().tx(p.getDescription());
      tr.td().tx(p.hasType() ? p.getType().toCode() : "");
    }
  }
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:19,代码来源:NarrativeGenerator.java


示例12: addLanguageRow

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
private void addLanguageRow(ValueSetExpansionContainsComponent c, XhtmlNode t, List<String> langs) {
  XhtmlNode tr = t.tr();
  tr.td().addText(c.getCode());
  for (String lang : langs) {
    String d = null;
    for (Extension ext : c.getExtension()) {
      if (ToolingExtensions.EXT_TRANSLATION.equals(ext.getUrl())) {
        String l = ToolingExtensions.readStringExtension(ext, "lang");
        if (lang.equals(l))
          d = ToolingExtensions.readStringExtension(ext, "content");;
      }
    }
    tr.td().addText(d == null ? "" : d);
  }
  for (ValueSetExpansionContainsComponent cc : c.getContains()) {
    addLanguageRow(cc, t, langs);
  }
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:19,代码来源:NarrativeGenerator.java


示例13: addCodeToTable

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
private void addCodeToTable(boolean isAbstract, String system, String code, String display, XhtmlNode td) {
  CodeSystem e = context.fetchCodeSystem(system);
  if (e == null || e.getContent() != org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode.COMPLETE) {
    if (isAbstract)
      td.i().setAttribute("title", ABSTRACT_CODE_HINT).addText(code);
    else if ("http://snomed.info/sct".equals(system)) {
      td.ah("http://browser.ihtsdotools.org/?perspective=full&conceptId1="+code).addText(code);
    } else if ("http://loinc.org".equals(system)) {
        td.ah("http://details.loinc.org/LOINC/"+code+".html").addText(code);
    } else        
      td.addText(code);
  } else {
    String href = prefix+getCsRef(e);
    if (href.contains("#"))
      href = href + "-"+Utilities.nmtokenize(code);
    else
      href = href + "#"+e.getId()+"-"+Utilities.nmtokenize(code);
    if (isAbstract)
      td.ah(href).setAttribute("title", ABSTRACT_CODE_HINT).i().addText(code);
    else
      td.ah(href).addText(code);
  }
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:24,代码来源:NarrativeGenerator.java


示例14: newCondition

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
/**
 * Returns a FHIR Condition for testing purposes.
 */
public static Condition newCondition() {

  Condition condition = new Condition();

  // Condition based on example from FHIR:
  // https://www.hl7.org/fhir/condition-example.json.html
  condition.setId("Condition/example");

  condition.setLanguage("en_US");

  // Narrative text
  Narrative narrative = new Narrative();
  narrative.setStatusAsString("generated");
  narrative.setDivAsString("This data was generated for test purposes.");
  XhtmlNode node = new XhtmlNode();
  node.setNodeType(NodeType.Text);
  node.setValue("Severe burn of left ear (Date: 24-May 2012)");
  condition.setText(narrative);

  condition.setSubject(new Reference("Patient/example").setDisplay("Here is a display for you."));

  condition.setVerificationStatus(Condition.ConditionVerificationStatus.CONFIRMED);

  // Condition code
  CodeableConcept code = new CodeableConcept();
  code.addCoding()
      .setSystem("http://snomed.info/sct")
      .setCode("39065001")
      .setDisplay("Severe");
  condition.setSeverity(code);

  // Severity code
  CodeableConcept severity = new CodeableConcept();
  severity.addCoding()
      .setSystem("http://snomed.info/sct")
      .setCode("24484000")
      .setDisplay("Burn of ear")
      .setUserSelected(true);
  condition.setSeverity(severity);

  // Onset date time
  DateTimeType onset = new DateTimeType();
  onset.setValueAsString("2012-05-24");
  condition.setOnset(onset);

  return condition;
}
 
开发者ID:cerner,项目名称:bunsen,代码行数:51,代码来源:TestData.java


示例15: getDiv

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
/**
 * @return {@link #div} (The actual narrative content, a stripped down version of XHTML.)
 */
public XhtmlNode getDiv() { 
  if (this.div == null)
    if (Configuration.errorOnAutoCreate())
      throw new Error("Attempt to auto-create Narrative.div");
    else if (Configuration.doAutoCreate())
      this.div = new XhtmlNode(); // cc
  return this.div;
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:12,代码来源:Narrative.java


示例16: compareDeep

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
public static boolean compareDeep(XhtmlNode div1, XhtmlNode div2, boolean allowNull) {
if (div1 == null && div2 == null && allowNull)
	return true;
if (div1 == null || div2 == null)
	return false;
return div1.equalsDeep(div2);
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:8,代码来源:Base.java


示例17: parseXhtml

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
protected XhtmlNode parseXhtml(String value) throws IOException, FHIRFormatError {
   XhtmlParser prsr = new XhtmlParser();
   try {
	return prsr.parse(value, "div").getChildNodes().get(0);
} catch (org.hl7.fhir.exceptions.FHIRFormatError e) {
	throw new FHIRFormatError(e.getMessage(), e);
}
 }
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:9,代码来源:JsonParserBase.java


示例18: composeXhtml

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
protected void composeXhtml(String name, XhtmlNode html) throws IOException {
	if (!Utilities.noString(xhtmlMessage)) {
     prop(name, "<div>!-- "+xhtmlMessage+" --></div>");
	} else {
	XhtmlComposer comp = new XhtmlComposer(XhtmlComposer.XML, htmlPretty);
	prop(name, comp.compose(html));
	}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:9,代码来源:JsonParserBase.java


示例19: generateTable

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
public XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set<String> outputTracker) throws IOException, FHIRException {
  assert(diff != snapshot);// check it's ok to get rid of one of these
  HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
  gen.setTranslator(getTranslator());
  TableModel model = gen.initNormalTable(corePath, false);
  List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
  List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
  profiles.add(profile);
  genElement(defFile == null ? null : defFile+"#", gen, model.getRows(), list.get(0), list, profiles, diff, profileBaseFileName, null, snapshot, corePath, imagePath, true, logicalModel, profile.getDerivation() == TypeDerivationRule.CONSTRAINT && usesMustSupport(list), allInvariants);
  try {
    return gen.generate(model, imagePath, 0, outputTracker);
	} catch (org.hl7.fhir.exceptions.FHIRException e) {
		throw new FHIRException(e.getMessage(), e);
	}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:16,代码来源:ProfileUtilities.java


示例20: generateGrid

import org.hl7.fhir.utilities.xhtml.XhtmlNode; //导入依赖的package包/类
public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker) throws IOException, FHIRException {
  HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
  gen.setTranslator(getTranslator());
  TableModel model = gen.initGridTable(corePath);
  List<ElementDefinition> list = profile.getSnapshot().getElement();
  List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
  profiles.add(profile);
  genGridElement(defFile == null ? null : defFile+"#", gen, model.getRows(), list.get(0), list, profiles, true, profileBaseFileName, null, corePath, imagePath, true, profile.getDerivation() == TypeDerivationRule.CONSTRAINT && usesMustSupport(list));
  try {
    return gen.generate(model, imagePath, 1, outputTracker);
  } catch (org.hl7.fhir.exceptions.FHIRException e) {
    throw new FHIRException(e.getMessage(), e);
  }
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:15,代码来源:ProfileUtilities.java



注:本文中的org.hl7.fhir.utilities.xhtml.XhtmlNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultProtocolSocketFactory类代码示例发布时间:2022-05-22
下一篇:
Java UserCoreConstants类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap