Java XML Node Name getNodeNameWithNamespace(Node node)

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

Description

get Node Name With Namespace

License

Open Source License

Declaration

private static String getNodeNameWithNamespace(Node node) 

Method Source Code

//package com.java2s;
/*---------------------------------------------------------------
*  Copyright 2005 by the Radiological Society of North America
*
*  This source software is released under the terms of the
*  RSNA Public License (http://mirc.rsna.org/rsnapubliclicense)
*----------------------------------------------------------------*/

import org.w3c.dom.Node;

public class Main {
    private static String getNodeNameWithNamespace(Node node) {
        String name = node.getNodeName();
        String ns = node.getNamespaceURI();
        String prefix = (ns != null) ? node.lookupPrefix(ns) : null;
        if ((prefix != null) && !name.startsWith(prefix + ":")) {
            name = prefix + ":" + name;
        }/*from  w  ww. jav  a2  s. c o  m*/
        return name;
    }
}

Related

  1. getNodeName(Node node)
  2. getNodeName(Node node)
  3. getNodeName(Node node)
  4. getNodeNameIgnorePrefix(Node node)
  5. getNodeNames(Set nodes)
  6. getNodes(Node iNode, String iNodeName)
  7. getNodes(Node module, String interfaceName, String nodeName)
  8. getNodes(Node node, String nodeName)
  9. getSimpleName(final Node node)