Example usage for org.jdom2 Element setNamespace

List of usage examples for org.jdom2 Element setNamespace

Introduction

In this page you can find the example usage for org.jdom2 Element setNamespace.

Prototype

public Element setNamespace(Namespace namespace) 

Source Link

Document

Sets the element's Namespace .

Usage

From source file:org.yawlfoundation.yawl.elements.YTask.java

License:Open Source License

private void addDefaultValuesAsRequired(Document dataDoc) {
    if (dataDoc == null)
        return;/*from w  ww. j a  va  2 s .  c om*/
    Element dataElem = dataDoc.getRootElement();
    for (YParameter param : _decompositionPrototype.getOutputParameters().values()) {
        String defaultValue = param.getDefaultValue();
        if (!StringUtil.isNullOrEmpty(defaultValue)) {
            Element paramData = dataElem.getChild(param.getPreferredName());

            // if there's an element, but no value, add the default
            if (paramData != null) {
                if (StringUtil.isNullOrEmpty(paramData.getText())) {
                    paramData.setText(defaultValue);
                }
            }

            // else if there's no element at all, add it with the default value
            else {
                Element defElem = JDOMUtil
                        .stringToElement(StringUtil.wrap(defaultValue, param.getPreferredName()));
                defElem.setNamespace(dataElem.getNamespace());
                dataElem.addContent(Math.min(dataElem.getContentSize(), param.getOrdering()), defElem.detach());
            }
        }
    }
}

From source file:pt.ist.socialsoftware.edition.export.ExpertEditionTEIExport.java

License:Creative Commons License

private Element generateCorpus() {
    this.jdomDoc = new Document();
    Element rootElement = new Element("teiCorpus");

    rootElement.setNamespace(this.xmlns);

    rootElement.addNamespaceDeclaration(Namespace.getNamespace("svg", "http://www.w3.org/2000/svg"));

    rootElement.addNamespaceDeclaration(Namespace.getNamespace("xi", "http://www.w3.org/2001/XInclude"));

    this.jdomDoc.setRootElement(rootElement);
    return rootElement;
}

From source file:pt.ist.socialsoftware.edition.visitors.TEIGenerator.java

License:Creative Commons License

private Element generateCorpus() {
    jdomDoc = new Document();
    Element rootElement = new Element("teiCorpus");

    rootElement.setNamespace(xmlns);

    rootElement.addNamespaceDeclaration(Namespace.getNamespace("svg", "http://www.w3.org/2000/svg"));

    rootElement.addNamespaceDeclaration(Namespace.getNamespace("xi", "http://www.w3.org/2001/XInclude"));

    jdomDoc.setRootElement(rootElement);
    return rootElement;
}