Here you can find the source of getNodeNameWithNamespace(Node node)
private static String getNodeNameWithNamespace(Node node)
//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; } }