public static void writeXdmValue(Processor proc, Vector<XdmValue> values, Destination destination, URI baseURI) throws SaxonApiException { try { Configuration config = proc.getUnderlyingConfiguration(); PipelineConfiguration pipeConfig = config.makePipelineConfiguration(); Receiver out = destination.getReceiver(config); TreeReceiver tree = new TreeReceiver(out); tree.setPipelineConfiguration(pipeConfig); if (baseURI != null) { tree.setSystemId(baseURI.toASCIIString()); } tree.open(); tree.startDocument(0); for (XdmValue value : values) { for (XdmItem item : (Iterable<XdmItem>) value) { tree.append((Item) item.getUnderlyingValue(), VoidLocation.instance(), NodeInfo.ALL_NAMESPACES); } } tree.endDocument(); tree.close(); } catch (XPathException err) { throw new SaxonApiException(err); } }
public static void writeXdmValue(XProcRuntime runtime, XdmItem node, Destination destination, URI baseURI) throws SaxonApiException { try { Processor proc = runtime.getProcessor(); Configuration config = proc.getUnderlyingConfiguration(); PipelineConfiguration pipeConfig = config.makePipelineConfiguration(); Receiver out = destination.getReceiver(config); TreeReceiver tree = new TreeReceiver(out); tree.setPipelineConfiguration(pipeConfig); if (baseURI != null) { tree.setSystemId(baseURI.toASCIIString()); } tree.open(); tree.startDocument(0); tree.append((Item) node.getUnderlyingValue(), VoidLocation.instance(), NodeInfo.ALL_NAMESPACES); tree.endDocument(); tree.close(); } catch (XPathException err) { throw new SaxonApiException(err); } }
public static void writeXdmValue(XProcRuntime runtime, XdmItem node, Destination destination, URI baseURI) throws SaxonApiException { try { Processor proc = runtime.getProcessor(); Configuration config = proc.getUnderlyingConfiguration(); PipelineConfiguration pipeConfig = config.makePipelineConfiguration(); Receiver out = destination.getReceiver(config); TreeReceiver tree = new TreeReceiver(out); tree.setPipelineConfiguration(pipeConfig); if (baseURI != null) { tree.setSystemId(baseURI.toASCIIString()); } tree.open(); tree.startDocument(0); Location locationId; { if (baseURI != null && config.isLineNumbering()) { int lineNumber = node instanceof XdmNode ? ((XdmNode)node).getLineNumber() : -1; if (lineNumber > 0) locationId = new LineNumberLocation(baseURI.toASCIIString(), lineNumber); else locationId = VoidLocation.instance(); } else locationId = VoidLocation.instance(); } tree.append((Item) node.getUnderlyingValue(), locationId, NodeInfo.ALL_NAMESPACES); tree.endDocument(); tree.close(); } catch (XPathException err) { throw new SaxonApiException(err); } }
tree.setPipelineConfiguration(pipeConfig); if (baseURI != null) { tree.setSystemId(baseURI.toASCIIString());