public static String getXML(final EventList events) {
        try {
            final TransformerHandler th = XMLUtil.createTransformerHandler(false);
            final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            th.setResult(new StreamResult(outputStream));

            events.fire(th);

            return outputStream.toString();

        } catch (final SAXException | TransformerConfigurationException | RuntimeException e) {
            throw ProcessException.create(e.getMessage());
        }
    }
Creates an XML string from the event stack captured for the matched
record.
stroom-pipeline/src/main/java/stroom/pipeline/xml/event/EventListUtils.java