file.getParentFile().mkdirs();
TransformerFactory.newInstance().newTransformer().transform(new DOMSource(settings.getDocument()),
new StreamResult(new FileOutputStream(file)));
} catch (TransformerConfigurationException e) {
throw new SettingsException("Unable to write document", e);
} catch (TransformerException e) {
throw new SettingsException("Unable to write document", e);
} catch (TransformerFactoryConfigurationError e) {
throw new SettingsException("Unable to write document", e);
} catch (FileNotFoundException e) {
throw new SettingsException("Unable to write document", e);
}
}