Example usage for org.dom4j.tree DefaultElement addText

List of usage examples for org.dom4j.tree DefaultElement addText

Introduction

In this page you can find the example usage for org.dom4j.tree DefaultElement addText.

Prototype

public Element addText(String text) 

Source Link

Usage

From source file:com.mor.blogengine.model.BlogComment.java

License:Open Source License

@Override
public DefaultElement toElement() {

    // this is element Declaration in complete form.
    // QName lCommentTextDecl = new QName("CommentText", mNamespace);
    // QName lReturnelementdecl = new QName("Comment", mNamespace);
    DefaultElement lReturnElement = null;
    DefaultElement lCommentText = new DefaultElement("CommentText");

    lCommentText.addText(mCommentText);
    lReturnElement = new DefaultElement("Comment");

    // lReturnElement.add(mNamespace);
    lReturnElement.add(new DefaultAttribute("entryID", getEntryID()));
    lReturnElement.add(new DefaultAttribute("ID", getEntityID()));
    lReturnElement.add(new DefaultAttribute("date", mDate));
    lReturnElement.add(new DefaultAttribute("author", mAuthor));
    lReturnElement.add(new DefaultAttribute("webPage", mWebPage));
    lReturnElement.add(lCommentText);/*from  w  ww . j  a  v  a  2  s.  c  o m*/

    return lReturnElement;
}

From source file:com.mor.blogengine.model.BlogEntry.java

License:Open Source License

/**
 *
 * @return XML node representation of entry
 *///w ww .ja v a2s.co  m
@Override
public DefaultElement toElement() {

    // this is element Declaration in complete form.
    // QName lElementDecl = new QName("Entry", mNamespace);
    DefaultElement lReturnElement = new DefaultElement("Entry");

    lReturnElement.add(new DefaultAttribute("date", getDate()));
    lReturnElement.add(new DefaultAttribute("categoryID", getCatID()));
    lReturnElement.add(new DefaultAttribute("allowComments", getAllowComments()));
    lReturnElement.add(new DefaultAttribute("ID", getEntityID()));

    //      this is element Declaration in complete form.
    // QName lEntryTextDecl = new QName("Text", mNamespace);
    DefaultElement lEntryText = new DefaultElement("Text");

    lEntryText.addText(mTexte);
    lReturnElement.add(lEntryText);

    // QName lResumeDecl = new QName("Resume", mNamespace);
    DefaultElement lEntryResume = new DefaultElement("Resume");

    lEntryResume.addText(mResume);
    lReturnElement.add(lEntryResume);

    return lReturnElement;
}

From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java

License:Apache License

public void addTimerFor(String pipelineName, String timerSpec) {
    Element pipeline = pipelineElement(pipelineName);
    List elements = pipeline.elements();
    DefaultElement element = new DefaultElement("timer");
    element.addText(timerSpec);
    elements.add(0, element);//from  w ww . j a v  a 2  s .  c  o m
}

From source file:com.thoughtworks.cruise.utils.configfile.CruiseConfigDom.java

License:Apache License

public void addResourceToJob(String resource, String jobName) {
    Element resources = findOrCreateElement(job(jobName), "resources");
    if (resources.selectSingleNode("/resource[text()='" + resource + "']") == null) {
        DefaultElement resourceElement = new DefaultElement("resource");
        resourceElement.addText(resource);
        resources.add(resourceElement);//from  ww w  .  ja va  2 s . c  o  m
    }

}

From source file:org.jetbrains.kotlin.projectsextensions.maven.buildextender.PomXmlModifier.java

License:Apache License

private void createStdlibDependency(Element dependencies) {
    QName dependencyQname = new QName("dependency", dependencies.getQName().getNamespace());
    DefaultElement dependency = new DefaultElement(dependencyQname);

    QName groupIdQname = new QName("groupId", dependencies.getQName().getNamespace());
    DefaultElement groupId = new DefaultElement(groupIdQname);
    groupId.addText(groupIdName);

    QName artifactIdQname = new QName("artifactId", dependencies.getQName().getNamespace());
    DefaultElement artifactId = new DefaultElement(artifactIdQname);
    artifactId.addText("kotlin-stdlib");

    QName versionQname = new QName("version", dependencies.getQName().getNamespace());
    DefaultElement version = new DefaultElement(versionQname);
    version.addText(kotlinVersion);//  www . j av  a2s. c  o m

    dependency.add(groupId);
    dependency.add(artifactId);
    dependency.add(version);

    dependencies.content().add(dependency);
}

From source file:org.jetbrains.kotlin.projectsextensions.maven.buildextender.PomXmlModifier.java

License:Apache License

private void addExecution(Element executions, String id, String phase, String goal) {
    QName executionQname1 = new QName("execution", executions.getQName().getNamespace());
    DefaultElement execution = new DefaultElement(executionQname1);

    QName idQname1 = new QName("id", executions.getQName().getNamespace());
    DefaultElement id1 = new DefaultElement(idQname1);
    id1.addText(id);
    QName phaseQname1 = new QName("phase", executions.getQName().getNamespace());
    DefaultElement phase1 = new DefaultElement(phaseQname1);
    phase1.addText(phase);//from w  w  w .  ja va2  s.  c  om
    QName goalsQname1 = new QName("goals", executions.getQName().getNamespace());
    DefaultElement goals1 = new DefaultElement(goalsQname1);
    QName goalQname1 = new QName("goal", executions.getQName().getNamespace());
    DefaultElement goal1 = new DefaultElement(goalQname1);
    goal1.addText(goal);

    goals1.add(goal1);

    execution.add(id1);
    execution.add(phase1);
    execution.add(goals1);

    executions.add(execution);
}

From source file:org.jetbrains.kotlin.projectsextensions.maven.buildextender.PomXmlModifier.java

License:Apache License

private void createPluginElement(Element plugins) {
    QName pluginQname = new QName("plugin", plugins.getQName().getNamespace());
    DefaultElement plugin = new DefaultElement(pluginQname);

    QName groupIdQname = new QName("groupId", plugins.getQName().getNamespace());
    DefaultElement groupId = new DefaultElement(groupIdQname);
    groupId.addText(groupIdName);

    QName artifactIdQname = new QName("artifactId", plugins.getQName().getNamespace());
    DefaultElement artifactId = new DefaultElement(artifactIdQname);
    artifactId.addText("kotlin-maven-plugin");

    QName versionQname = new QName("version", plugins.getQName().getNamespace());
    DefaultElement version = new DefaultElement(versionQname);
    version.addText(kotlinVersion);/*from  ww w. j  a  v  a2  s . c  o m*/

    plugin.add(groupId);
    plugin.add(artifactId);
    plugin.add(version);

    addExecutions(plugin);

    plugins.add(plugin);
}