Code example for Element

Methods: getAttributeNode, getParentNode

0
        } 
        return getNamespaceURI(currentNode, name);
    } 
 
    private String getNamespaceURI(Element e, String name) {
        Attr attr = e.getAttributeNode(name);
        if (attr == null) {
            Node n = e.getParentNode();
            if (n instanceof Element && n != e) {
                return getNamespaceURI((Element) n, name);
            } 
        } else { 
            return attr.getValue();
        } 
 
        return null; 
    } 
 
    public String getPrefix(String uri) {
        return getPrefix(currentNode, uri);
    }