@Override
    public void endElement(final String uri, final String localName, final String qName) throws SAXException {
        if (EVENT_TAG.equals(localName)) {
            if (lastStreamId == null) {
                log(Severity.ERROR, "StreamId must be a long integer, but none provided ", null);
            } else if (lastEventId == null) {
                log(Severity.ERROR, "EventId must be a long integer, but none provided ", null);
            } else {
                long streamId = 0;
                try {
                    streamId = Long.parseLong(lastStreamId);
                } catch (NumberFormatException ex) {
                    log(Severity.ERROR, "StreamId must be a long integer.  Got " + lastStreamId, null);
                }
                if (streamId > 0) {
                    try {
                        long eventId = Long.parseLong(lastEventId);

                        currentEventIds.add(new EventId(streamId, eventId));
                    } catch (NumberFormatException ex) {
                        log(Severity.ERROR, "EventId must be a long integer.  Got " + lastEventId, null);
                    }
                }
            }
        } else if (ANNOTATION_TAG.equals(localName)) {
            currentRequest.linkedEvents(currentEventIds);
            final CreateAnnotationRequest request = currentRequest.build();
            try {
                annotationCreator.createAnnotation(request);

            } catch (final RuntimeException e) {
                log(Severity.ERROR, "Unable to create annotation " + request.getTitle(), e);
            }
            currentRequest = CreateAnnotationRequest.builder();
            currentEventIds = new ArrayList<>();
        } else if (TITLE_TAG.equals(localName)) {
            currentRequest.title(content.toString());
        } else if (DESCRIPTION_TAG.equals(localName)) {
            currentRequest.subject(content.toString());
        } else if (EVENTID_TAG.equals(localName)) {
            lastEventId = content.toString();
        } else if (STREAMID_TAG.equals(localName)) {
            lastStreamId = content.toString();
        }

        content.clear();
        super.endElement(uri, localName, qName);
    }
Sets the locator to use when reporting errors.

@param locator The locator to use.
stroom-annotation/stroom-annotation-pipeline/src/main/java/stroom/annotation/pipeline/AnnotationWriter.java