@Test public void testEvaluateXQueryShouldReturnOutputStream() throws SaxonApiException { String actual = underTest.evaluateXQuery(INPUT, QUERY); assertEquals(actual, outputStream.toString()); }
public String evaluateXQuery(final String xml, final String query) throws SaxonApiException { Processor processor = processorFactory.createProcessor(); XQueryCompiler xqueryCompiler = processor.newXQueryCompiler(); xqueryCompiler.setErrorListener(errorListener); XQueryExecutable xqueryExec = xqueryCompiler.compile(query); XQueryEvaluator xqueryEval = xqueryExec.load(); xqueryEval.setErrorListener(errorListener); SAXSource requestXml = saxSourceFactory.createSAXSource(inputSourceFactory.createInputSource(xml)); xqueryEval.setSource(requestXml); ByteArrayOutputStream baos = byteArrayOutputStreamFactory.createByteArrayOutputStream(); Serializer ser = serializerFactory.createSerializer(baos); xqueryEval.setDestination(ser); xqueryEval.run(); return baos.toString(); }
XQueryExpressionEvaluator { public String evaluateXQuery(final String xml, final String query) throws SaxonApiException { Processor processor = processorFactory.createProcessor(); XQueryCompiler xqueryCompiler = processor.newXQueryCompiler(); xqueryCompiler.setErrorListener(errorListener); XQueryExecutable xqueryExec = xqueryCompiler.compile(query); XQueryEvaluator xqueryEval = xqueryExec.load(); xqueryEval.setErrorListener(errorListener); SAXSource requestXml = saxSourceFactory.createSAXSource(inputSourceFactory.createInputSource(xml)); xqueryEval.setSource(requestXml); ByteArrayOutputStream baos = byteArrayOutputStreamFactory.createByteArrayOutputStream(); Serializer ser = serializerFactory.createSerializer(baos); xqueryEval.setDestination(ser); xqueryEval.run(); return baos.toString(); } }
XQueryExpressionEvaluator { public String evaluateXQuery(final String xml, final String query) throws SaxonApiException { Processor processor = processorFactory.createProcessor(); XQueryCompiler xqueryCompiler = processor.newXQueryCompiler(); xqueryCompiler.setErrorListener(errorListener); XQueryExecutable xqueryExec = xqueryCompiler.compile(query); XQueryEvaluator xqueryEval = xqueryExec.load(); xqueryEval.setErrorListener(errorListener); SAXSource requestXml = saxSourceFactory.createSAXSource(inputSourceFactory.createInputSource(xml)); xqueryEval.setSource(requestXml); ByteArrayOutputStream baos = byteArrayOutputStreamFactory.createByteArrayOutputStream(); Serializer ser = serializerFactory.createSerializer(baos); xqueryEval.setDestination(ser); xqueryEval.run(); return baos.toString(); }  }
XQueryExpressionEvaluator { public String evaluateXQuery(final String xml, final String query) throws SaxonApiException { Processor processor = processorFactory.createProcessor(); XQueryCompiler xqueryCompiler = processor.newXQueryCompiler(); xqueryCompiler.setErrorListener(errorListener); XQueryExecutable xqueryExec = xqueryCompiler.compile(query); XQueryEvaluator xqueryEval = xqueryExec.load(); xqueryEval.setErrorListener(errorListener); SAXSource requestXml = saxSourceFactory.createSAXSource(inputSourceFactory.createInputSource(xml)); xqueryEval.setSource(requestXml); ByteArrayOutputStream baos = byteArrayOutputStreamFactory.createByteArrayOutputStream(); Serializer ser = serializerFactory.createSerializer(baos); xqueryEval.setDestination(ser); xqueryEval.run(); return baos.toString(); }  String evaluateXQuery(final String xml, final String query); }
XQueryExpressionEvaluator { public String evaluateXQuery(final String xml, final String query) throws SaxonApiException { Processor processor = processorFactory.createProcessor(); XQueryCompiler xqueryCompiler = processor.newXQueryCompiler(); xqueryCompiler.setErrorListener(errorListener); XQueryExecutable xqueryExec = xqueryCompiler.compile(query); XQueryEvaluator xqueryEval = xqueryExec.load(); xqueryEval.setErrorListener(errorListener); SAXSource requestXml = saxSourceFactory.createSAXSource(inputSourceFactory.createInputSource(xml)); xqueryEval.setSource(requestXml); ByteArrayOutputStream baos = byteArrayOutputStreamFactory.createByteArrayOutputStream(); Serializer ser = serializerFactory.createSerializer(baos); xqueryEval.setDestination(ser); xqueryEval.run(); return baos.toString(); }  String evaluateXQuery(final String xml, final String query);  }