private String getFooter() {
        if (outputStreamWriter.getCount() == 0) {
            return null;
        }

        String xml = null;

        outputStreamWriter.flush();

        final char[] buffer = outputStreamWriter.getBuffer();
        xml = new String(buffer, 0, outputStreamWriter.getCount());

        outputStreamWriter.reset();

        return xml;
    }
Don't end prefix mappings if we are at the root element. Leave the end
processing method to do this.
stroom-pipeline/src/main/java/stroom/pipeline/record/XMLRecordEmitter.java