Example usage for org.dom4j QName QName

List of usage examples for org.dom4j QName QName

Introduction

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

Prototype

public QName(String name, Namespace namespace) 

Source Link

Usage

From source file:org.jasig.portal.layout.dlm.providers.AllUsersEvaluatorFactory.java

License:Apache License

@Override
public void toElement(Element parent) {

    // Assertions.
    if (parent == null) {
        String msg = "Argument 'parent' cannot be null.";
        throw new IllegalArgumentException(msg);
    }//from w  ww  .j ava  2 s  .com

    Element rslt = null;
    QName q = new QName("audience", FragmentDefinition.NAMESPACE);
    rslt = DocumentHelper.createElement(q);
    rslt.addAttribute("evaluatorFactory", this.getFactoryClass().getName());
    parent.add(rslt);

}

From source file:org.jasig.portal.layout.dlm.providers.Paren.java

License:Apache License

@Override
public void toElement(Element parent) {

    // Assertions.
    if (parent == null) {
        String msg = "Argument 'parent' cannot be null.";
        throw new IllegalArgumentException(msg);
    }/*from  ww  w  .  j  av a2  s  . c  o  m*/

    // NB:  This method behaves vastly different depending on whether 
    // the parent of this Paren is an instance of FragmentDefinition.
    Element rslt = null;
    if (parent.getName().equals("fragment")) {

        // The parent is a fragment, so we render as a <dlm:audience> element...
        QName q = new QName("audience", FragmentDefinition.NAMESPACE);
        rslt = DocumentHelper.createElement(q);

        // Discover the EvaluatorFactory class...
        rslt.addAttribute("evaluatorFactory", this.getFactoryClass().getName());

    } else {

        // The parent is *not* a fragment, so we render as a <paren> element...
        rslt = DocumentHelper.createElement("paren");
        rslt.addAttribute("mode", this.type.toString());

    }

    // Serialize our children...
    for (Evaluator v : this.evaluators) {
        v.toElement(rslt);
    }

    // Append ourself...
    parent.add(rslt);

}

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

License:Apache License

private Element createDependenciesElement(Element root) {
    QName qname = new QName("dependencies", root.getQName().getNamespace());
    DefaultElement dependenciesElement = new DefaultElement(qname);

    root.content().add(dependenciesElement);

    return root.element("dependencies");
}

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

License:Apache License

private Element createBuildElement(Element root) {
    QName qname = new QName("build", root.getQName().getNamespace());
    DefaultElement buildElement = new DefaultElement(qname);

    root.content().add(buildElement);//  w  w w . jav a 2  s  . c  o  m

    return root.element("build");
}

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

License:Apache License

private Element createPluginsElement(Element root) {
    QName qname = new QName("plugins", root.getQName().getNamespace());
    DefaultElement pluginsElement = new DefaultElement(qname);

    root.content().add(pluginsElement);//  www  .  j  a  v a  2  s  .com

    return root.element("plugins");
}

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);//from ww w.ja v a2s . com

    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);

    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);/*w w  w .  ja  v a 2s  .co  m*/
    QName phaseQname1 = new QName("phase", executions.getQName().getNamespace());
    DefaultElement phase1 = new DefaultElement(phaseQname1);
    phase1.addText(phase);
    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 addExecutions(Element plugin) {
    QName executionsQname = new QName("executions", plugin.getQName().getNamespace());
    DefaultElement executions = new DefaultElement(executionsQname);

    addExecution(executions, "compile", "process-sources", "compile");
    addExecution(executions, "test-compile", "process-test-sources", "test-compile");

    plugin.add(executions);//from  w  w  w  .  j  a  v  a  2  s  .  co m
}

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);/*from w  w  w  . j av  a  2 s .  co  m*/

    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);

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

    addExecutions(plugin);

    plugins.add(plugin);
}

From source file:org.jinglenodes.credit.ChargeServiceProcessor.java

License:Open Source License

public ChargeServiceProcessor(final String elementName, final String xmlns) {
    this.xmlns = xmlns;
    this.requestElement = DocumentHelper.createElement(new QName(elementName, new Namespace("", xmlns)));
}