Example usage for org.dom4j DocumentFactory createText

List of usage examples for org.dom4j DocumentFactory createText

Introduction

In this page you can find the example usage for org.dom4j DocumentFactory createText.

Prototype

public Text createText(String text) 

Source Link

Usage

From source file:de.innovationgate.wga.common.WGAXML.java

License:Apache License

/**
 * add a default database element to the given parentElement (<contentdbs>)
 * @param parent//from  w ww  .  j a  v  a  2 s.  c  o  m
 * @param implClass
 * @return the created contentdb-element
 */
public static Element addContentDB(Element parent, String implClass) {
    DocumentFactory factory = DocumentFactory.getInstance();

    Element database = factory.createElement("contentdb");
    database.addAttribute("enabled", "true");
    database.addAttribute("lazyconnect", "false");

    Element elem = factory.createElement("type");
    database.add(elem);
    elem.add(factory.createText(implClass));

    elem = factory.createElement("dbkey");
    database.add(elem);
    elem.add(factory.createText("(Enter database key here)"));

    elem = factory.createElement("dbpath");
    database.add(elem);
    elem.add(factory.createText("(Enter database path here)"));

    elem = factory.createElement("title");
    database.add(elem);

    elem = factory.createElement("domain");
    database.add(elem);
    elem.add(factory.createText("default"));

    elem = factory.createElement("design");
    database.add(elem);
    elem.addAttribute("provider", "none");
    elem.addAttribute("mode", "");
    elem.addAttribute("key", "");

    elem = factory.createElement("dboptions");
    database.add(elem);
    createDefaultDbOptions(elem);

    elem = factory.createElement("publisheroptions");
    database.add(elem);
    createDefaultPublisherOptions(elem);

    database.add(factory.createElement("storedqueries"));
    database.add(factory.createElement("fieldmappings"));
    Element cache = database.addElement("cache");
    cache.addAttribute("path", "");
    cache.addAttribute("type", "de.innovationgate.wgpublisher.cache.WGACacheHSQLDB");
    cache.addAttribute("maxpages", "3000");

    //lucene config per db
    Element luceneDBConfig = factory.createElement("lucene");
    luceneDBConfig.addAttribute("enabled", "false");
    luceneDBConfig.addElement("itemrules");
    LuceneIndexItemRule.addDefaultRule(luceneDBConfig);
    luceneDBConfig.addElement("filerules");
    LuceneIndexFileRule.addDefaultRule(luceneDBConfig);
    database.add(luceneDBConfig);

    // Client restrictions
    Element clientrestrictions = database.addElement("clientrestrictions");
    clientrestrictions.addAttribute("enabled", "false");
    clientrestrictions.addElement("restrictions");

    parent.add(database);
    return database;
}

From source file:de.innovationgate.wga.common.WGAXML.java

License:Apache License

/**
 * add a default persDbElement to the given parentElement (<personalisationdbs>)
 * @param parent/*  ww  w  .  ja  v a  2s  . com*/
 * @param implClass
 * @return the created persDbElement
 */
public static Element addPersDB(Element parent, String implClass) {
    DocumentFactory factory = DocumentFactory.getInstance();

    Element database = factory.createElement("personalisationdb");
    database.addAttribute("enabled", "true");
    database.addAttribute("lazyconnect", "false");

    Element elem = factory.createElement("type");
    database.add(elem);
    elem.add(factory.createText(implClass));

    elem = factory.createElement("dbpath");
    database.add(elem);
    elem.add(factory.createText("(Enter database path here)"));

    elem = factory.createElement("domain");
    database.add(elem);
    elem.add(factory.createText("default"));

    elem = factory.createElement("persconfig");
    database.add(elem);
    elem.addAttribute("mode", "auto");

    elem = factory.createElement("dboptions");
    database.add(elem);
    createDefaultDbOptions(elem);

    elem = factory.createElement("publisheroptions");
    database.add(elem);
    createDefaultPublisherOptions(elem);

    database.add(factory.createElement("userclasses"));

    parent.add(database);
    return database;
}

From source file:org.orbeon.oxf.xml.dom4j.Dom4jUtils.java

License:Open Source License

public static Text createText(final String text) {
    final DocumentFactory factory = NonLazyUserDataDocumentFactory.getInstance();
    return factory.createText(text);
}