Here you can find the source of getAttributeValue(final Node candidate, final String attributName)
static String getAttributeValue(final Node candidate, final String attributName)
//package com.java2s; /*/*from w w w .jav a 2s. c o m*/ * Geotoolkit.org - An Open Source Java GIS Toolkit * http://www.geotoolkit.org * * (C) 2016, 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.NamedNodeMap; import org.w3c.dom.Node; public class Main { /** * Returns the attribut value or null if attribut does not exist. */ static String getAttributeValue(final Node candidate, final String attributName) { final NamedNodeMap attributs = candidate.getAttributes(); if (attributs != null) { final Node attribut = attributs.getNamedItem(attributName); if (attribut != null) { return attribut.getNodeValue(); } } return null; } }