/** * Serialize a document containing wrapped query results (or any other document, in fact) * as XML. * @param node The document or element to be serialized * @param destination The Result object to contain the serialized form * @param outputProperties Serialization options, as defined in JAXP. The requested properties are * not validated. * @param config The Configuration. This argument is ignored * @throws XPathException If serialization fails * @deprecated since 8.9; use {@link #serialize(NodeInfo, Result, Properties)} instead. */ //@SuppressWarnings({"UnusedDeclaration"}) public static void serialize(NodeInfo node, Result destination, Properties outputProperties, Configuration config) throws XPathException { serialize(node, destination, outputProperties); }
@Override public void translate(Writer writer) throws TransformerException, IOException { QueryResult.serializeSequence(new PushBackSequenceIterator(iter, item, next), config, writer, DEFAULT_OUTPUT_PROPERTIES); } }, context);
try { if (props == null) { return QueryResult.serialize(((NodeOverNodeInfo) item).getUnderlyingNodeInfo()); } else { Writer writer = new StringWriter(); QueryResult.serialize(((NodeOverNodeInfo) item).getUnderlyingNodeInfo(), new StreamResult(writer), props); writer.close(); return writer.toString(); SequenceIterator itr = new XQSequenceIterator((XQSequence) item, config); try { QueryResult.serializeSequence(itr, config, writer, props); writer.close(); } catch (IOException | XPathException ex) {
/** * Take the results of a query (or any other SequenceIterator) and create * an XML document containing copies of all items in the sequence, each item wrapped in a containing * element that identifies its type * * @param iterator The values to be wrapped * @param config The Saxon configuration used to evaluate the query * @return the document containing the wrapped results * @throws XPathException if any failure occurs * @since 8.8 */ /*@Nullable*/ public static DocumentInfo wrap(SequenceIterator iterator, /*@NotNull*/ Configuration config) throws XPathException { PipelineConfiguration pipe = config.makePipelineConfiguration(); TinyBuilder builder = new TinyBuilder(pipe); builder.setStatistics(Statistics.SOURCE_DOCUMENT_STATISTICS); NamespaceReducer reducer = new NamespaceReducer(builder); ComplexContentOutputter outputter = new ComplexContentOutputter(reducer); sendWrappedSequence(iterator, outputter); return new DocumentInfo(builder.getCurrentRoot()); }
XQueryExpression e = exp.getUnderlyingCompiledQuery(); SequenceIterator results = e.iterator(evaluator.getUnderlyingQueryContext()); DocumentInfo resultDoc = QueryResult.wrap(results, config); XdmValue wrappedResultDoc = XdmValue.wrap(resultDoc.getUnderlyingNode()); processor.writeXdmValue(wrappedResultDoc, destination);
public void update(NodeInfo node, Controller controller) throws XPathException { try { DocumentPool pool = controller.getDocumentPool(); String documentURI = pool.getDocumentURI(node); if (documentURI != null) { QueryResult.rewriteToDisk(node, outputProps, backup, (showTime ? System.err : null)); } else if (showTime) { System.err.println("Updated document discarded because it was not read using doc()"); } } catch (XPathException err) { System.err.println(err.getMessage()); errors.add(err); } } };
/** * Take the results of a query (or any other SequenceIterator) and create * an XML document containing copies of all items in the sequence, each item wrapped in a containing * element that identifies its type * * @param iterator The values to be wrapped * @param config The Saxon configuration used to evaluate the query * @return the document containing the wrapped results * @throws XPathException if any failure occurs * @since 8.8 */ /*@Nullable*/ public static DocumentInfo wrap(SequenceIterator iterator, /*@NotNull*/ Configuration config) throws XPathException { PipelineConfiguration pipe = config.makePipelineConfiguration(); TinyBuilder builder = new TinyBuilder(pipe); builder.setStatistics(config.getTreeStatistics().SOURCE_DOCUMENT_STATISTICS); NamespaceReducer reducer = new NamespaceReducer(builder); ComplexContentOutputter outputter = new ComplexContentOutputter(reducer); sendWrappedSequence(iterator, outputter); return new DocumentInfo(builder.getCurrentRoot()); }
XQueryExpression e = exp.getUnderlyingCompiledQuery(); SequenceIterator results = e.iterator(evaluator.getUnderlyingQueryContext()); DocumentInfo resultDoc = QueryResult.wrap(results, config); XdmValue wrappedResultDoc = XdmValue.wrap(resultDoc.getUnderlyingNode()); processor.writeXdmValue(wrappedResultDoc, destination);
/** * Serialize a document containing wrapped query results (or any other document, in fact) * as XML. * @param node The document or element to be serialized * @param destination The Result object to contain the serialized form * @param outputProperties Serialization options, as defined in JAXP. The requested properties are * not validated. * @param config The Configuration. This argument is ignored * @throws XPathException If serialization fails * @deprecated since 8.9; use {@link #serialize(NodeInfo, Result, Properties)} instead. */ //@SuppressWarnings({"UnusedDeclaration"}) public static void serialize(NodeInfo node, Result destination, Properties outputProperties, Configuration config) throws XPathException { serialize(node, destination, outputProperties); }
@Override public void translate(Writer writer) throws TransformerException, IOException { QueryResult.serializeSequence(iter.getAnother(), config, writer, DEFAULT_OUTPUT_PROPERTIES); } }, context);
indent.setProperty(OutputKeys.INDENT, "yes"); System.err.println("DeepEqual: first argument:"); QueryResult.serialize(QueryResult.wrap(arg1.getAnother(), context.getConfiguration()), new StreamResult(System.err), indent); System.err.println("DeepEqual: second argument:"); QueryResult.serialize(QueryResult.wrap(arg2.getAnother(), context.getConfiguration()), new StreamResult(System.err), indent);
/** * Take the results of a query (or any other SequenceIterator) and create * an XML document containing copies of all items in the sequence, each item wrapped in a containing * element that identifies its type * @param iterator The values to be wrapped * @param config The Saxon configuration used to evaluate the query * @return the document containing the wrapped results * @throws XPathException * @since 8.8 */ public static DocumentInfo wrap(SequenceIterator iterator, Configuration config) throws XPathException { PipelineConfiguration pipe = config.makePipelineConfiguration(); TinyBuilder builder = new TinyBuilder(); builder.setPipelineConfiguration(pipe); NamespaceReducer reducer = new NamespaceReducer(); reducer.setUnderlyingReceiver(builder); reducer.setPipelineConfiguration(pipe); ComplexContentOutputter outputter = new ComplexContentOutputter(); outputter.setPipelineConfiguration(pipe); outputter.setReceiver(reducer); sendWrappedSequence(iterator, outputter); return (DocumentInfo)builder.getCurrentRoot(); }
private String serializeNode(NodeInfo node) throws XPathException { StringWriter sw = new StringWriter(); Properties props = new Properties(); props.setProperty("method", nodeOutputMethod); props.setProperty("indent", "no"); props.setProperty("omit-xml-declaration", "yes"); QueryResult.serialize(node, new StreamResult(sw), props); return sw.toString().trim(); }
@Override public void translate(Writer writer) throws TransformerException, IOException { QueryResult.serializeSequence(new PushBackSequenceIterator(iter, item, next), config, writer, DEFAULT_OUTPUT_PROPERTIES); } }, context);
indent.setProperty(OutputKeys.INDENT, "yes"); System.err.println("DeepEqual: first argument:"); QueryResult.serialize(QueryResult.wrap(arg1.getAnother(), context.getConfiguration()), new StreamResult(System.err), indent); System.err.println("DeepEqual: second argument:"); QueryResult.serialize(QueryResult.wrap(arg2.getAnother(), context.getConfiguration()), new StreamResult(System.err), indent);
/** * Take the results of a query (or any other SequenceIterator) and create * an XML document containing copies of all items in the sequence, each item wrapped in a containing * element that identifies its type * @param iterator The values to be wrapped * @param config The Saxon configuration used to evaluate the query * @return the document containing the wrapped results * @throws XPathException * @since 8.8 */ public static DocumentInfo wrap(SequenceIterator iterator, Configuration config) throws XPathException { PipelineConfiguration pipe = config.makePipelineConfiguration(); TinyBuilder builder = new TinyBuilder(); builder.setPipelineConfiguration(pipe); NamespaceReducer reducer = new NamespaceReducer(); reducer.setUnderlyingReceiver(builder); reducer.setPipelineConfiguration(pipe); ComplexContentOutputter outputter = new ComplexContentOutputter(); outputter.setPipelineConfiguration(pipe); outputter.setReceiver(reducer); sendWrappedSequence(iterator, outputter); return (DocumentInfo)builder.getCurrentRoot(); }
private String serializeNode(NodeInfo node) throws XPathException { StringWriter sw = new StringWriter(); Properties props = new Properties(); props.setProperty("method", nodeOutputMethod); props.setProperty("indent", "no"); props.setProperty("omit-xml-declaration", "yes"); QueryResult.serialize(node, new StreamResult(sw), props); return sw.toString().trim(); }
/** * Serialize an arbitrary sequence, without any special wrapping. * * @param iterator the sequence to be serialized * @param config the configuration (gives access to information such as the NamePool) * @param writer the writer to which the output is to be written * @param outputProps a set of serialization properties as defined in JAXP. The requested properties are * not validated. * @throws XPathException if any failure occurs * @since 8.9 */ public static void serializeSequence( SequenceIterator<?> iterator, Configuration config, Writer writer, Properties outputProps) throws XPathException { serializeSequence(iterator, config, new StreamResult(writer), outputProps); try { writer.flush(); } catch (IOException err) { throw new XPathException(err); } }
indent.setProperty(OutputKeys.INDENT, "yes"); System.err.println("DeepEqual: first argument:"); QueryResult.serialize(QueryResult.wrap(arg1.getAnother(), context.getConfiguration()), new StreamResult(System.err), indent); System.err.println("DeepEqual: second argument:"); QueryResult.serialize(QueryResult.wrap(arg2.getAnother(), context.getConfiguration()), new StreamResult(System.err), indent);