use of org.hl7.fhir.utilities.xhtml.XhtmlComposer in project org.hl7.fhir.core by hapifhir.
the class XmlParserBase method composeXhtml.
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);
}
}
use of org.hl7.fhir.utilities.xhtml.XhtmlComposer in project org.hl7.fhir.core by hapifhir.
the class BinaryRenderer method display.
public String display(Binary bin) throws IOException {
XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
render(div, bin);
return new XhtmlComposer(false, true).compose(div);
}
use of org.hl7.fhir.utilities.xhtml.XhtmlComposer in project org.hl7.fhir.core by hapifhir.
the class AdditionalBindingsRenderer method render.
public String render() throws IOException {
if (bindings.isEmpty()) {
return "";
} else {
XhtmlNode tbl = new XhtmlNode(NodeType.Element, "table");
tbl.attribute("class", "grid");
render(tbl.getChildNodes(), true);
return new XhtmlComposer(false).compose(tbl);
}
}
use of org.hl7.fhir.utilities.xhtml.XhtmlComposer in project org.hl7.fhir.core by hapifhir.
the class ComparisonRenderer method renderProfile.
private void renderProfile(String id, ProfileComparison comp) throws IOException {
String template = templates.get("Profile");
Map<String, Base> vars = new HashMap<>();
ProfileComparer cs = new ProfileComparer(session, new ProfileUtilities(session.getContextLeft(), null, session.getPkp()), new ProfileUtilities(session.getContextRight(), null, session.getPkp()));
vars.put("left", new StringType(comp.getLeft().present()));
vars.put("right", new StringType(comp.getRight().present()));
vars.put("leftId", new StringType(comp.getLeft().getId()));
vars.put("rightId", new StringType(comp.getRight().getId()));
vars.put("leftUrl", new StringType(comp.getLeft().getUrl()));
vars.put("rightUrl", new StringType(comp.getRight().getUrl()));
vars.put("errors", new StringType(new XhtmlComposer(true).compose(cs.renderErrors(comp))));
vars.put("metadata", new StringType(new XhtmlComposer(true).compose(cs.renderMetadata(comp, "", ""))));
vars.put("structure", new StringType(new XhtmlComposer(true).compose(cs.renderStructure(comp, "", "", "http://hl7.org/fhir"))));
String cnt = processTemplate(template, "CodeSystem", vars);
TextFile.stringToFile(cnt, file(comp.getId() + ".html"));
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(folder, comp.getId() + "-union.json")), comp.getUnion());
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(folder, comp.getId() + "-intersection.json")), comp.getIntersection());
}
use of org.hl7.fhir.utilities.xhtml.XhtmlComposer in project org.hl7.fhir.core by hapifhir.
the class ComparisonRenderer method renderValueSet.
private void renderValueSet(String id, ValueSetComparison comp) throws FHIRException, IOException {
String template = templates.get("ValueSet");
Map<String, Base> vars = new HashMap<>();
ValueSetComparer cs = new ValueSetComparer(session);
vars.put("left", new StringType(comp.getLeft().present()));
vars.put("right", new StringType(comp.getRight().present()));
vars.put("leftId", new StringType(comp.getLeft().getId()));
vars.put("rightId", new StringType(comp.getRight().getId()));
vars.put("leftUrl", new StringType(comp.getLeft().getUrl()));
vars.put("rightUrl", new StringType(comp.getRight().getUrl()));
vars.put("errors", new StringType(new XhtmlComposer(true).compose(cs.renderErrors(comp))));
vars.put("metadata", new StringType(new XhtmlComposer(true).compose(cs.renderMetadata(comp, "", ""))));
vars.put("compose", new StringType(new XhtmlComposer(true).compose(cs.renderCompose(comp, "", ""))));
vars.put("expansion", new StringType(new XhtmlComposer(true).compose(cs.renderExpansion(comp, "", ""))));
String cnt = processTemplate(template, "ValueSet", vars);
TextFile.stringToFile(cnt, file(comp.getId() + ".html"));
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(folder, comp.getId() + "-union.json")), comp.getUnion());
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(folder, comp.getId() + "-intersection.json")), comp.getIntersection());
}
Aggregations