use of org.hl7.fhir.utilities.json.JsonTrackingParser in project org.hl7.fhir.core by hapifhir.
the class CorePackageTools method buildXml.
private void buildXml(String json, String xml, String version) throws FHIRFormatError, IOException {
for (File f : new File(Utilities.path(json, "package")).listFiles()) {
if (f.getName().endsWith(".json")) {
JsonObject j = new JsonTrackingParser().parseJson(f);
if (j.has("resourceType")) {
if ("1.4".equals(version)) {
String n = f.getName();
System.out.println(n);
String xn = Utilities.changeFileExt(n, ".xml");
org.hl7.fhir.dstu2016may.model.Resource r = new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(new FileInputStream(f));
new org.hl7.fhir.dstu2016may.formats.XmlParser().setOutputStyle(org.hl7.fhir.dstu2016may.formats.IParser.OutputStyle.NORMAL).compose(new FileOutputStream(Utilities.path(xml, "package", xn)), r);
}
}
}
}
}
Aggregations