Example usage for org.dom4j Namespace NO_NAMESPACE

List of usage examples for org.dom4j Namespace NO_NAMESPACE

Introduction

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

Prototype

Namespace NO_NAMESPACE

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

Click Source Link

Document

No Namespace present

Usage

From source file:com.smartwork.im.utils.XMLWriter.java

License:Open Source License

public XMLWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException {
    this.format = format;
    this.writer = createWriter(out, format.getEncoding());
    this.autoFlush = true;
    namespaceStack.push(Namespace.NO_NAMESPACE);
}

From source file:com.smartwork.im.utils.XMLWriter.java

License:Open Source License

public XMLWriter(OutputFormat format) throws UnsupportedEncodingException {
    this.format = format;
    this.writer = createWriter(System.out, format.getEncoding());
    this.autoFlush = true;
    namespaceStack.push(Namespace.NO_NAMESPACE);
}

From source file:edu.ucsd.library.dams.jhove.MyJhoveBase.java

License:Open Source License

public static void removeNS(Element elem) {
    elem.remove(elem.getNamespace());//w  w  w  .j  a v  a  2  s  .c  o  m
    elem.setQName(new QName(elem.getQName().getName(), Namespace.NO_NAMESPACE));
    // fix children
    List children = elem.elements();
    for (int i = 0; i < children.size(); i++) {
        Element child = (Element) children.get(i);
        removeNS(child);
    }
}

From source file:fr.gouv.culture.vitam.utils.XmlDom.java

License:Open Source License

public final static void removeAllNamespaces(Document doc) {
    Element root = doc.getRootElement();
    Namespace namespace = root.getNamespace();
    if (namespace != Namespace.NO_NAMESPACE) {
        root.remove(namespace);/*from  w w w .  ja  v a  2 s  .  c o m*/
        removeNamespaces(root.content());
    }
}

From source file:fr.gouv.culture.vitam.utils.XmlDom.java

License:Open Source License

/**
 * Recursively removes the namespace of the element and all its children: sets to
 * Namespace.NO_NAMESPACE//from   w w w. j a va 2 s  . co  m
 */
public final static void removeNamespaces(Element elem) {
    setNamespaces(elem, Namespace.NO_NAMESPACE);
}

From source file:fr.gouv.culture.vitam.utils.XmlDom.java

License:Open Source License

/**
 * Recursively removes the namespace of the list and all its children: sets to
 * Namespace.NO_NAMESPACE/*from w w w .  j  av  a2s .  c  om*/
 */
private final static void removeNamespaces(List<?> l) {
    setNamespaces(l, Namespace.NO_NAMESPACE);
}

From source file:fr.gouv.culture.vitam.utils.XmlDom.java

License:Open Source License

/**
 * Recursively sets the namespace of the List and all children if the current namespace is match
 *//* w w  w.  j  a  v  a 2s  . c o  m*/
private final static void setNamespaces(List<?> l, Namespace ns) {
    Node n = null;
    for (int i = 0; i < l.size(); i++) {
        n = (Node) l.get(i);

        if (n.getNodeType() == Node.ATTRIBUTE_NODE) {
            Namespace namespace = ((Attribute) n).getNamespace();
            if (!namespace.equals(ns)) {
                ((Attribute) n).setNamespace(ns);
            }
        }
        if (n.getNodeType() == Node.ELEMENT_NODE) {
            Namespace namespace = ((Element) n).getNamespace();
            if (!namespace.equals(ns)) {
                if (ns.equals(Namespace.NO_NAMESPACE)) {
                    ((Element) n).remove(namespace);
                }
                setNamespaces((Element) n, ns);
            }
        }
    }
}

From source file:net.dontdrinkandroot.lastfm.api.CheckImplementationStatus.java

License:Apache License

/**
 * Removes namespaces if removeNamespaces is true
 *//*from ww w .j av a2s  .co m*/
@SuppressWarnings("unchecked")
public static void fixNamespaces(final Document doc) {

    final Element root = doc.getRootElement();
    if (CheckImplementationStatus.removeNamespaces && root.getNamespace() != Namespace.NO_NAMESPACE) {
        CheckImplementationStatus.removeNamespaces(root.content());
    }
}

From source file:net.dontdrinkandroot.lastfm.api.CheckImplementationStatus.java

License:Apache License

/**
 * Recursively removes the namespace of the element and all its children: sets to
 * Namespace.NO_NAMESPACE//from  w  w w.j  av a 2  s .  com
 */
public static void removeNamespaces(final Element elem) {

    CheckImplementationStatus.setNamespaces(elem, Namespace.NO_NAMESPACE);
}

From source file:net.dontdrinkandroot.lastfm.api.CheckImplementationStatus.java

License:Apache License

/**
 * Recursively removes the namespace of the list and all its children: sets to
 * Namespace.NO_NAMESPACE//from  w ww  . j av a  2 s.c om
 */
public static void removeNamespaces(final List<Node> l) {

    CheckImplementationStatus.setNamespaces(l, Namespace.NO_NAMESPACE);
}