StreamResult result = new StreamResult(xmlAsWriter);
try {
TransformerFactory.newInstance().newTransformer().transform(
new DOMSource(doc), result);
} catch (TransformerConfigurationException e) {
throw new SimalRepositoryException("Unable configure XSL Transformer", e);
} catch (TransformerException e) {
throw new SimalRepositoryException("Unable to transform document", e);
} catch (TransformerFactoryConfigurationError e) {
throw new SimalRepositoryException("Unable to create XSL Transformer", e);
}
String xml = xmlAsWriter.toString();
StringReader xmlReader = new StringReader(xml);
// FIXME Are we sure this is the right way? JavaDoc suggests otherwise.
model.read(xmlReader, "");