List of usage examples for org.dom4j.datatype DatatypeDocumentFactory getInstance
public static DocumentFactory getInstance()
Access to the singleton instance of this factory.
From source file:de.innovationgate.wgpublisher.lucene.LuceneIndexConfiguration.java
License:Open Source License
public LuceneIndexConfiguration(WGACore core, File indexDir) throws IllegalArgumentException, DocumentException { _core = core;/*from w ww .j av a 2s. c o m*/ _configFile = new File(indexDir, "wgalucene.xml"); if (!_configFile.exists()) { _newConfiguration = true; _configDoc = DatatypeDocumentFactory.getInstance().createDocument(); _configDocRoot = _configDoc.addElement("wgalucene"); _configDocRoot.addAttribute("version", VERSION); } else { SAXReader saxReader = new SAXReader(); saxReader.setDocumentFactory(DatatypeDocumentFactory.getInstance()); _configDoc = saxReader.read(_configFile); _configDocRoot = _configDoc.getRootElement(); // check if configfile has right version String version = _configDocRoot.attributeValue("version"); if ((version == null) || (!version.equals(VERSION))) { _core.getLog().warn("Unsupported index configuration found. New configuration will be created ..."); _newConfiguration = true; _configDoc = DatatypeDocumentFactory.getInstance().createDocument(); _configDocRoot = _configDoc.addElement("wgalucene"); _configDocRoot.addAttribute("version", VERSION); } } }
From source file:org.dom4j.samples.DatatypeDemo.java
License:Open Source License
protected Document parse(String xmlFile) throws Exception { SAXReader reader = new SAXReader(); reader.setDocumentFactory(DatatypeDocumentFactory.getInstance()); return reader.read(xmlFile); }