TreeReceiver tree = new TreeReceiver(out); tree.open(); tree.startDocument(0); for (XdmItem item : value) { tree.append(item.getUnderlyingValue(), ExplicitLocation.UNKNOWN_LOCATION, ReceiverOptions.ALL_NAMESPACES);
TreeReceiver tree = new TreeReceiver(out); tree.open(); tree.startDocument(0); for (XdmItem item : value) { tree.append(item.getUnderlyingValue(), ExplicitLocation.UNKNOWN_LOCATION, ReceiverOptions.ALL_NAMESPACES);
/** * Append an arbitrary item (node or atomic value) to the output */ public void append(Item item, int locationId, int copyNamespaces) throws XPathException { if (item instanceof AtomicValue) { if (previousAtomic) { characters(" ", locationId, 0); } characters(item.getStringValueCS(), locationId, 0); previousAtomic = true; } else if (((NodeInfo)item).getNodeKind() == Type.DOCUMENT) { startDocument(0); // needed to ensure that illegal namespaces or attributes in the content are caught SequenceIterator iter = ((NodeInfo)item).iterateAxis(Axis.CHILD); while (true) { Item it = iter.next(); if (it == null) break; append(it, locationId, copyNamespaces); } previousAtomic = false; endDocument(); } else { ((NodeInfo)item).copy(this, copyNamespaces, true, locationId); previousAtomic = false; } }
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.startDocument(0); for (XdmValue value : values) { Location locationId; {