src/main/java/org/jboss/util/xml/catalog/helpers/Namespaces.java
public static String getNamespaceURI(Node node, String prefix) {
	if (node == null || node.getNodeType() != Node.ELEMENT_NODE) {
	    return null;
	}

	if (prefix.equals("")) {
	    if (((Element) node).hasAttribute("xmlns")) {
		return ((Element) node).getAttribute("xmlns");
	    }
	} else {
	    String nsattr = "xmlns:" + prefix;
	    if (((Element) node).hasAttribute(nsattr)) {
		return ((Element) node).getAttribute(nsattr);
	    }
	}

	return getNamespaceURI(node.getParentNode(), prefix);
    }
public static String getNamespaceURI(Node node, String prefix) {
	if (node == null || node.getNodeType() != Node.ELEMENT_NODE) {
	    return null;
	}

	if (prefix.equals("")) {
	    if (((Element) node).hasAttribute("xmlns")) {
		return ((Element) node).getAttribute("xmlns");
	    }
	} else {
	    String nsattr = "xmlns:" + prefix;
	    if (((Element) node).hasAttribute(nsattr)) {
		return ((Element) node).getAttribute(nsattr);
	    }
	}

	return getNamespaceURI(node.getParentNode(), prefix);
    }
public static String getNamespaceURI ( Node node , String prefix ) { if ( node == null || node . getNodeType ( ) != Node . ELEMENT_NODE ) { return null ; } if ( prefix . equals ( "" ) ) { if ( ( ( Element ) node ) . hasAttribute ( "xmlns" ) ) { return ( ( Element ) node ) . getAttribute ( "xmlns" ) ; } } else { String nsattr = "xmlns:" + prefix ; if ( ( ( Element ) node ) . hasAttribute ( nsattr ) ) { return ( ( Element ) node ) . getAttribute ( nsattr ) ; } } return getNamespaceURI ( node . getParentNode ( ) , prefix ) ; }
Returns the namespace URI for the specified prefix at the
specified context node.

@param node The context node.
@param prefix The prefix.
@return The namespace URI associated with the prefix, or
null if no namespace declaration exists for the prefix.
Returns the namespace URI for the specified prefix at the specified context node .