final EXistTreeBuilder builder = new EXistTreeBuilder(context);
response.outputResponseElement(builder);
final DocumentImpl doc = builder.close();
try {
// we add the root *element* to the result sequence
NodeTest kind = new TypeTest(Type.ELEMENT);
// the elem must always be added at the front, so if there are
// already other items, we create a new one, add the elem, then
// add the original items after
if(result.isEmpty()) {
doc.selectChildren(kind, result);