@Override
    public void endDocument() throws SAXException {
        //if (LOGGER.isTraceEnabled()) {
        //    LOGGER.trace("endDocument called, buffer [%s]", truncateAndStripWhitespace(getBuffer()));
        //}

        if (startedDocument) {
            handler.endDocument();
            super.endDocument();
            startedDocument = false;
        }
    }
Writes out XML and records segment boundaries as it goes.
stroom-pipeline/src/main/java/stroom/pipeline/writer/XMLWriter.java