diff --git a/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java b/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java index 3104c8f..8f6db9c 100644 --- a/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java +++ b/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java @@ -824,6 +824,7 @@ public void execute(String folder, String[] args) throws IOException { if (isGenerate && buildFlags.get("all")) produceQA(); + page.log("Max Memory Used = "+Utilities.describeSize(page.getMaxMemory()), LogMessageType.Process); if (!buildFlags.get("all")) { page.log("This was a Partial Build", LogMessageType.Process); CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); @@ -1871,13 +1872,13 @@ private void addTypes(CodeSystem cs, StructureDefinition sd, List", "").trim(); - e.setElement(new Manager().parseSingle(page.getWorkerContext(), new StringInputStream(xml), FhirFormat.XML)); - e.setResource(new XmlParser().parse(xml)); - } } catch (Throwable ex) { StringWriter errors = new StringWriter(); System.out.println("Error generating narrative for example "+e.getName()+": "+ex.getMessage()); -// ex.printStackTrace(); + ex.printStackTrace(); XhtmlNode xhtml = new XhtmlNode(NodeType.Element, "div"); xhtml.addTag("p").setAttribute("style", "color: maroon").addText("Error processing narrative: " + ex.getMessage()); xhtml.addTag("p").setAttribute("style", "color: maroon").addText(errors.toString()); narrative = new XhtmlComposer(XhtmlComposer.HTML).compose(xhtml); } - + try { + if (e.getResource() == null && e.getElement() == null) { + String xml = XMLUtil.elementToString(e.getXml().getDocumentElement()).replace("", "").trim(); + e.setElement(new Manager().parseSingle(page.getWorkerContext(), new StringInputStream(xml), FhirFormat.XML)); + e.setResource(new XmlParser().parse(xml)); + } + } catch (Throwable ex) { + System.out.println("Error reparsing example "+e.getName()+": "+ex.getMessage()); + } if (rt.equals("ValueSet")) { try { ValueSet vs = (ValueSet) loadExample(file);