use of org.exist.xquery.NodeTest in project exist by eXist-db.
the class EXistResult method add.
@Override
public void add(final HttpResponse response) throws HttpClientException {
final EXistTreeBuilder builder = new EXistTreeBuilder(context);
response.outputResponseElement(builder);
final DocumentImpl doc = builder.close();
try {
// we add the root *element* to the result sequence
final NodeTest kind = new TypeTest(Type.ELEMENT);
// add the original items after
if (result.isEmpty()) {
doc.selectChildren(kind, result);
} else {
final ValueSequence newResult = new ValueSequence();
doc.selectChildren(kind, newResult);
newResult.addAll(result);
result = newResult;
}
} catch (final XPathException xpe) {
throw new HttpClientException("Unable to add HttpResponse to result:" + xpe.getMessage(), xpe);
}
}
Aggregations