} else {
throw new DynamicError("Cannot add to an existing Saxon document");
}
} else {
// Non-Saxon DOM
DOMEmitter emitter = new DOMEmitter();
emitter.setSystemId(result.getSystemId());
emitter.setConfiguration(config);
emitter.setNode(resultNode);
return emitter;
}
} else {
// no result node supplied; we must create our own
TinyBuilder builder = new TinyBuilder();