use of org.dom4j.Document in project gradle by gradle.
the class DOM4JSerializer method readSettingsFile.
public static DOM4JSettingsNode readSettingsFile(ImportInteraction importInteraction, FileFilter fileFilter) {
File file = importInteraction.promptForFile(fileFilter);
if (file == null) {
return null;
}
if (!file.exists()) {
importInteraction.reportError("File does not exist: " + file.getAbsolutePath());
//we should really sit in a loop until they cancel or give us a valid file.
return null;
}
try {
SAXReader reader = new SAXReader();
Document document = reader.read(file);
return new DOM4JSettingsNode(document.getRootElement());
} catch (Throwable t) {
LOGGER.error("Unable to read file: " + file.getAbsolutePath(), t);
importInteraction.reportError("Unable to read file: " + file.getAbsolutePath());
return null;
}
}
use of org.dom4j.Document in project gradle by gradle.
the class DOM4JSerializer method createBlankSettings.
public static DOM4JSettingsNode createBlankSettings() {
Document document = DocumentHelper.createDocument();
Element rootElement = document.addElement("root");
DOM4JSettingsNode settings = new DOM4JSettingsNode(rootElement);
return settings;
}
use of org.dom4j.Document in project JessMA by ldcsaa.
the class DruidSessionMgr method loadXmlCfg.
@SuppressWarnings("unchecked")
private void loadXmlCfg(Properties props) throws Exception {
SAXReader sr = new SAXReader();
Document doc = sr.read(new File(configFile));
Element root = doc.getRootElement();
List<Element> list = root.elements("property");
for (Element e : list) {
String key = e.attributeValue("name");
String value = e.getTextTrim();
props.put(key, value);
}
}
use of org.dom4j.Document in project JessMA by ldcsaa.
the class AppConfig method getRootElement.
private Element getRootElement() throws DocumentException {
SAXReader sr = new SAXReader();
Document doc = sr.read(new File(confFile));
Element root = doc.getRootElement();
return root;
}
use of org.dom4j.Document in project cuba by cuba-platform.
the class XMLConverter2 method _process.
protected Document _process(Entity entity, View view) throws Exception {
Document document = DocumentHelper.createDocument();
Element rootEl = document.addElement("instances");
encodeEntity(entity, new HashSet<Entity>(), view, rootEl);
return document;
}
Aggregations