Java XML Attribute Get getAttribute(Node node, String attributeName)

Here you can find the source of getAttribute(Node node, String attributeName)

Description

get Attribute

License

Open Source License

Declaration

public static String getAttribute(Node node, String attributeName) 

Method Source Code

//package com.java2s;
/*//from w  w w  . j av  a  2  s  .  c o  m
 * NodeUtil.java
 * 
 * Copyright (c) 2008-2010 CSIRO, Delft University of Technology.
 * 
 * This file is part of Darjeeling.
 * 
 * Darjeeling 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, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Darjeeling 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.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with Darjeeling.  If not, see <http://www.gnu.org/licenses/>.
 */

import org.w3c.dom.Node;

public class Main {
    public static String getAttribute(Node node, String attributeName) {
        Node attributeNode = node.getAttributes().getNamedItem(attributeName);

        if (attributeNode == null)
            return null;
        else
            return attributeNode.getNodeValue();
    }
}

Related

  1. getAttribute(Node node, String attr)
  2. getAttribute(Node node, String attr)
  3. getAttribute(Node node, String attribName)
  4. getAttribute(Node node, String attribute)
  5. getAttribute(Node node, String attributeName)
  6. getAttribute(Node node, String attributeName)
  7. getAttribute(Node node, String attributeName)
  8. getAttribute(Node node, String attributeName)
  9. getAttribute(Node node, String attributeName)