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

        depth++;
        try {
            if (depth == 1) {
                if (!topLevelElementToSkip.equals(localName)) {
                    xPathExecutables = null;
                    topLevelElementToSkip = localName;
                }
                topLevelUri = uri;
                topLevelQName = qName;
                topLevelAtts = atts;

            } else if (depth == 2) {
                if (!secondLevelElementToCreateDocs.equals((localName))) {
                    secondLevelElementToCreateDocs = localName;
                    xPathExecutables = null;
                }
                if (xPathExecutables == null) {
                    createXPathExecutables();
                }

                //Start new document
                builder = new TinyBuilder(pipeConfig);
                contentHandler = new ReceivingContentHandler();
                contentHandler.setPipelineConfiguration(pipeConfig);
                contentHandler.setReceiver(builder);

                for (String key : prefixMappings.keySet()) {
                    contentHandler.startPrefixMapping(key, prefixMappings.get(key));
                }
                contentHandler.startDocument();

                contentHandler.startElement(topLevelUri, topLevelElementToSkip, topLevelQName, topLevelAtts);

                contentHandler.startElement(uri, localName, qName, atts);
            } else {
                contentHandler.startElement(uri, localName, qName, atts);
            }
        } catch (SAXException saxException) {

            log(Severity.ERROR, LogUtil.message("XML error creating element {}", localName), saxException);
        }

    }
Sets the locator to use when reporting errors.

@param locator The locator to use.
stroom-search/stroom-search-extraction/src/main/java/stroom/search/extraction/XPathExtractionOutputFilter.java