try (ByteArrayOutputStream os = new ByteArrayOutputStream();) {
transformer.transform(new DOMSource(document), new StreamResult(os));
return new String(os.toByteArray(), "UTF-8");
}
} catch (Exception ex) {
throw new JuRuntimeException("Couldn't convert XML to String", ex);
}
}