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 .