// Write the resource content to disk. This step is needed, as the preview
// generator can only handle files.
try {
xhtmlFile = File.createTempFile("xhtml", ".xml");
Serializer xhtmlSerializer = new SimpleXmlSerializer(xhtmlProperties);
xhtmlSerializer.writeToFile(xhtmlNode, xhtmlFile.getAbsolutePath(), "UTF-8");
} catch (IOException e) {
logger.error("Error creating temporary copy of file content at " + xhtmlFile, e);
FileUtils.deleteQuietly(xhtmlFile);
throw e;
} finally {