public void close(Result result) throws TransformerException { String href = result.getSystemId(); XdmDestination xdmResult = secondaryResults.get(href); XdmNode doc = xdmResult.getXdmNode(); try { S9apiUtils.assertDocument(doc); secondaryPipe.write(doc); } catch (XProcException e) { // If the document isn't well-formed XML, encode it as text if (runtime.getAllowTextResults()) { // Document is apparently not well-formed XML. TreeWriter tree = new TreeWriter(runtime); tree.startDocument(doc.getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.addAttribute(_content_type, "text/plain"); tree.addAttribute(cx_decode, "true"); tree.startContent(); tree.addText(doc.toString()); tree.addEndElement(); tree.endDocument(); secondaryPipe.write(tree.getResult()); } else { throw new XProcException(step.getStep(), "p:xslt returned non-XML secondary result", e.getCause()); } } } }
public void close(Result result) throws TransformerException { String href = result.getSystemId(); XdmDestination xdmResult = secondaryResults.get(href); XdmNode doc = xdmResult.getXdmNode(); try { S9apiUtils.assertDocument(doc); secondaryPipe.write(doc); } catch (XProcException e) { // If the document isn't well-formed XML, encode it as text if (runtime.getAllowTextResults()) { // Document is apparently not well-formed XML. TreeWriter tree = new TreeWriter(runtime); tree.startDocument(doc.getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.addAttribute(_content_type, "text/plain"); tree.addAttribute(cx_decode, "true"); tree.startContent(); tree.addText(doc.toString()); tree.addEndElement(); tree.endDocument(); secondaryPipe.write(tree.getResult()); } else { throw new XProcException(step.getStep(), "p:xslt returned non-XML secondary result", e.getCause()); } } } }
node = tree.getResult(); } else { throw new XProcException(step.getStep(), "p:xquery returned non-XML result", e.getCause());
node = tree.getResult(); } else { throw new XProcException(step.getStep(), "p:xquery returned non-XML result", e.getCause());
resultPipe.write(tree.getResult()); } else { throw new XProcException(step.getStep(), "p:xslt returned non-XML result", e.getCause());
resultPipe.write(tree.getResult()); } else { throw new XProcException(step.getStep(), "p:xslt returned non-XML result", e.getCause());