Java XML Node Namespace getNamespace(Node node)

Here you can find the source of getNamespace(Node node)

Description

Gets the namespace of the given node.

License

Open Source License

Declaration

public static String getNamespace(Node node) 

Method Source Code

//package com.java2s;

import org.w3c.dom.*;

public class Main {
    /** Gets the namespace of the given node. */
    public static String getNamespace(Node node) {
        String name = node.getNodeName();
        int colon = name.lastIndexOf(":");
        return colon < 0 ? null : name.substring(0, colon);
    }/*w  w w .j a  v  a  2s  . c o  m*/
}

Related

  1. convertFromNamespaceForm(final Node node)
  2. copyNamespaces(Node source, Node target)
  3. getNamespace(Node node)
  4. getNamespace(String prefix, Node e)
  5. getNamespaceDeclarations(Node node)
  6. getNamespaceMappings(Node node)
  7. getNamespaces(Node node, Map list)