Here you can find the source of getNodeByLocalName(final Node parent, final String name)
public static Node getNodeByLocalName(final Node parent, final String name)
//package com.java2s; /*//w ww .j ava 2s .com * Geotoolkit.org - An Open Source Java GIS Toolkit * http://www.geotoolkit.org * * (C) 2010, Geomatys * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /** * Return the first node in the given node children which localName * matchs the given name. Or null if there are no such node. */ public static Node getNodeByLocalName(final Node parent, final String name) { if (name.equalsIgnoreCase(parent.getLocalName())) return parent; final NodeList lst = parent.getChildNodes(); for (int i = 0, n = lst.getLength(); i < n; i++) { final Node child = lst.item(i); if (name.equalsIgnoreCase(child.getLocalName())) { return child; } } return null; } }