IOException, XQueryException {
XQEngine engine = new XQEngineClient(remoteEndpoint);
String query = IOUtils.toString(new FileInputStream(fileName));
QueryRequest request = new QueryRequest(query, ReturnType.ASYNC_REMOTE_SEQUENCE);
Sequence<Item> resultSeq = (Sequence<Item>) engine.execute(request);
Writer writer = new FastBufferedWriter(new OutputStreamWriter(System.out), 4096);
SAXWriter saxwr = new SAXWriter(writer, "UTF-8");
Serializer ser = new SAXSerializer(saxwr, writer);
ser.emit(resultSeq);
writer.flush();
}