Example usage for org.jdom2 Namespace NO_NAMESPACE

List of usage examples for org.jdom2 Namespace NO_NAMESPACE

Introduction

In this page you can find the example usage for org.jdom2 Namespace NO_NAMESPACE.

Prototype

Namespace NO_NAMESPACE

To view the source code for org.jdom2 Namespace NO_NAMESPACE.

Click Source Link

Document

Define a Namespace for when not in a namespace

Usage

From source file:org.mycore.frontend.xeditor.MCRXEditorTransformer.java

License:Open Source License

private Element createRootElement(String xPath) throws JaxenException {
    BaseXPath baseXPath = new BaseXPath(xPath, new DocumentNavigator());
    LocationPath lp = (LocationPath) (baseXPath.getRootExpr());
    NameStep nameStep = (NameStep) (lp.getSteps().get(0));
    String prefix = nameStep.getPrefix();
    Namespace ns = prefix.isEmpty() ? Namespace.NO_NAMESPACE : MCRConstants.getStandardNamespace(prefix);
    return new Element(nameStep.getLocalName(), ns);
}

From source file:org.rascalmpl.library.lang.xml.DOM.java

License:Open Source License

private Namespace namespaceToNamespace(IConstructor ns) {
    if (ns.getConstructorType() == Factory.Namespace_none) {
        return Namespace.NO_NAMESPACE;
    }//from ww  w .j  a va 2  s  .  co  m
    IString prefix = (IString) ns.get(0);
    IString uri = (IString) ns.get(1);
    return Namespace.getNamespace(prefix.getValue(), uri.getValue());
}

From source file:org.rascalmpl.library.lang.xml.DOM.java

License:Open Source License

private IConstructor convertNamespace(Namespace ns) {
    if (ns == Namespace.NO_NAMESPACE) {
        return vf.constructor(Factory.Namespace_none);
    }//from w  ww .  j  av a  2s. c om
    IString prefix = vf.string(ns.getPrefix());
    IString uri = vf.string(ns.getURI());
    IConstructor nscon = vf.constructor(Factory.Namespace_namespace, prefix, uri);
    return nscon;
}

From source file:se.miun.itm.input.util.xml.XPathProcessor.java

License:Open Source License

public static String correctNamespaceInPUT(String expression, Namespace nameSpace) {
    if (!nameSpace.equals(Namespace.NO_NAMESPACE)) {
        for (int i = 0; i < Q.DESIGN_SPACE_ELEMENT_IDS.length; i++) {
            expression = expression.replace(Q.DESIGN_SPACE_ELEMENT_IDS[i],
                    Q.DESIGN_SPACE_NAMESPACE.getPrefix() + ":" + Q.DESIGN_SPACE_ELEMENT_IDS[i]);
        }//from  w  ww. ja  v a 2  s .c  o  m
    }
    return expression;
}

From source file:utils.ParserXML.java

License:Apache License

public String getStringedSubTree(String element) throws JDOMException, IOException {
    String s = "";
    Element elem = rootElement.getChild(element);
    Iterator lst = elem.getDescendants();
    int i;//from ww w.j  av a2  s  .  c  o  m
    Element e = document.detachRootElement();
    e.removeNamespaceDeclaration(Namespace.NO_NAMESPACE);
    Element e2 = e.getChild(element);
    XMLOutputter xout = new XMLOutputter();
    Format f = Format.getPrettyFormat();
    xout.setFormat(f);
    return ((xout.outputString(e2).replaceAll("<" + element + ">", "")).replaceAll("</" + element + ">", ""));
}