use of org.hl7.fhir.utilities.xml.XMLWriter in project org.hl7.fhir.core by hapifhir.
the class XmlParserBase method compose.
/**
* Compose a resource to a stream, possibly using pretty presentation for a human reader, and maybe a different choice in the xhtml narrative (used in the spec in one place, but should not be used in production)
* @
*/
public void compose(OutputStream stream, Resource resource, boolean htmlPretty) throws IOException {
XMLWriter writer = new XMLWriter(stream, "UTF-8");
writer.setPretty(style == OutputStyle.PRETTY);
writer.start();
compose(writer, resource, htmlPretty);
writer.end();
}
use of org.hl7.fhir.utilities.xml.XMLWriter in project kindling by HL7.
the class BuildWorkerContext method saveLoinc.
public void saveLoinc(String filename) throws IOException {
XMLWriter xml = new XMLWriter(new FileOutputStream(filename), "UTF-8");
xml.setPretty(true);
xml.setLineType(XMLWriter.LINE_UNIX);
xml.start();
xml.enter("loinc");
List<String> codes = new ArrayList<String>();
codes.addAll(loincCodes.keySet());
Collections.sort(codes);
for (String c : codes) {
xml.attribute("id", c);
Concept cc = loincCodes.get(c);
xml.attribute("short", cc.shortN);
xml.attribute("long", cc.display);
xml.element("concept");
}
xml.exit("loinc");
xml.end();
xml.close();
}
use of org.hl7.fhir.utilities.xml.XMLWriter in project kindling by HL7.
the class BuildWorkerContext method saveSnomed.
public void saveSnomed(String filename) throws Exception {
FileOutputStream file = new FileOutputStream(filename);
XMLWriter xml = new XMLWriter(file, "UTF-8");
xml.setPretty(true);
xml.setLineType(XMLWriter.LINE_UNIX);
xml.start();
xml.comment("the build tool builds these from the designated snomed server, when it can", true);
xml.enter("snomed");
List<String> ids = new ArrayList<String>();
ids.addAll(snomedCodes.keySet());
Collections.sort(ids);
for (String s : ids) {
xml.attribute("id", s);
Concept c = snomedCodes.get(s);
xml.attribute("display", c.display);
if (c.displays.size() == 0)
xml.element("concept", null);
else {
xml.enter("concept");
for (String d : c.displays) {
xml.attribute("value", d);
xml.element("display", null);
}
xml.exit("concept");
}
}
xml.exit("snomed");
xml.end();
}
use of org.hl7.fhir.utilities.xml.XMLWriter in project kindling by HL7.
the class SvgGenerator method generate.
public void generate(ResourceDefn resource, String filename, String id) throws Exception {
this.id = id;
classes.clear();
links.clear();
XMLWriter xml = new XMLWriter(new FileOutputStream(filename), "UTF-8");
generate(resource, xml);
}
use of org.hl7.fhir.utilities.xml.XMLWriter in project kindling by HL7.
the class SvgGenerator method textForAttribute.
private String[] textForAttribute(ElementDefn e) throws Exception {
LineStatus ls = new LineStatus();
// this is a dummary
XMLWriter xml = new XMLWriter(new ByteArrayOutputStream(), "UTF-8");
xml.start();
addAttribute(xml, 0, 0, e, "Element.id", ls, 0, 0);
ls.close();
return ls.list.toArray(new String[] {});
}
Aggregations