@Override
    public void startElement(final String uri, final String localName, final String qName, final Attributes atts)
            throws SAXException {
        depth++;

        // Mark the start location on every start element with a depth lower (closer to root)
        // than our split depth so we can get the start position to be just before
        // our record start element
        if (depth < splitDepth) {
            LOGGER.trace("startElement({}), depth: {}", localName, depth);
            if (locationHolder != null) {
                locationHolder.markStartLocation();
            }
        } else if (depth == splitDepth) {
            LOGGER.trace("startElement({}), depth: {}", localName, depth);
            buffer = false;

            // We are going to fire some events at the child filter so set this
            // flag so that start and end document events aren't fired again
            // when end document is called.
            hasFiredEvents = true;

            // Increment the split count.
            count++;

            if (count == 1) {
                // We should only fire all buffered SAX events if the current
                // count is 1.
                super.startDocument();
                fireStartEvents(0, length);

            } else {
                // Otherwise just fire buffered SAX events after the root
                // element.
                fireStartEvents(afterRoot, length);
            }
        }

        if (!buffer) {
            super.startElement(uri, localName, qName, atts);
        } else if (inRoot || afterRoot == -1) {
            ensureArraySize();
            events[length++] = new StartElement(uri, localName, qName, atts);
        }

        // If this is the root element then remember the position in the
        // stack for this element.
        if (depth == 1) {
            if (afterRoot == -1) {
                afterRoot = length;
            }

            inRoot = true;
        }
    }
<p>
This method stores the start element if the element depth is less than
the split depth. If the element depth is the same as the split depth then
it will fire all stored start events and begin output of all child
elements.
<p>

@param uri       The element's Namespace URI, or the empty string.
@param localName The element's local name, or the empty string.
@param qName     The element's qualified (prefixed) name, or the empty string.
@param atts      The element's attributes.
@throws org.xml.sax.SAXException The client may throw an exception during processing.
@see stroom.pipeline.filter.AbstractXMLFilter#startElement(java.lang.String,
java.lang.String, java.lang.String, org.xml.sax.Attributes)
stroom-pipeline/src/main/java/stroom/pipeline/filter/SplitFilter.java