本文整理汇总了Java中org.hl7.fhir.utilities.xhtml.XhtmlNode类的典型用法代码示例。如果您正苦于以下问题:Java XhtmlNode类的具体用法?Java XhtmlNode怎么用?Java XhtmlNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XhtmlNode类属于org.hl7.fhir.utilities.xhtml包,在下文中一共展示了XhtmlNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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);
}
}
示例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);
// }
}
}
示例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?
// }
}
示例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());
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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() : "");
}
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}