Here you can find the source of getElementNS(Element el, String nsuri, String name)
public static Element getElementNS(Element el, String nsuri, String name)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Element getElementNS(Element el, String nsuri, String name) { Node node = el.getFirstChild(); while (node != null) { if (matchNS(node, nsuri, name)) { return (Element) node; }//from www . ja va 2 s. c o m node = node.getNextSibling(); } return null; } public static boolean matchNS(Node node, String nsuri, String name) { if (nsuri == null) { return node.getNamespaceURI() == null && node.getLocalName().equals(name); } else { return nsuri.equals(node.getNamespaceURI()) && node.getLocalName().equals(name); } } }