Java tutorial
//package com.java2s; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { public static String getNamespaceURI(Document doc, String ns) { NamedNodeMap attr = doc.getDocumentElement().getAttributes(); for (int i = 0; i < attr.getLength(); i++) { Node attrNode = attr.item(i); if (attrNode.getNodeName().indexOf(ns) != -1) { return (attrNode.getNodeValue()); } } return null; } }