use of org.exist.contentextraction.ContentReceiver in project exist by eXist-db.
the class ContentFunctions method streamContent.
private Sequence streamContent(ContentExtraction ce, BinaryValue binary, Sequence pathSeq, FunctionReference ref, Map<String, String> mappings, Sequence data) throws XPathException {
NodePath[] paths = new NodePath[pathSeq.getItemCount()];
int i = 0;
for (SequenceIterator iter = pathSeq.iterate(); iter.hasNext(); i++) {
String path = iter.nextItem().getStringValue();
paths[i] = new NodePath(mappings, path, false);
}
ContentReceiver receiver = new ContentReceiver(context, paths, ref, data);
try {
ce.extractContentAndMetadata(binary, receiver);
} catch (IOException | SAXException | ContentExtractionException ex) {
LOG.error(ex.getMessage(), ex);
throw new XPathException(this, ex.getMessage(), ex);
}
return receiver.getResult();
}
Aggregations