Java XML Attribute Get getAttribute(Node n, String name)

Here you can find the source of getAttribute(Node n, String name)

Description

get Attribute

License

Open Source License

Declaration

public static String getAttribute(Node n, String name) 

Method Source Code

//package com.java2s;
/* Copyright (c) 2016 by crossmobile.org
 *
 * CrossMobile is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 2.
 *
 * CrossMobile 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with CrossMobile; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *///from w  w  w  . j  a va 2 s  .  c o  m

import org.w3c.dom.Element;

import org.w3c.dom.Node;

public class Main {
    public static String getAttribute(Node n, String name) {
        if (n == null || name == null)
            return null;
        if (n instanceof Element)
            return ((Element) n).getAttribute(name);
        return null;
    }
}

Related

  1. getAttribute(Node element, String attName)
  2. getAttribute(Node element, String name, String dflt)
  3. getAttribute(Node iNode, String iAttributeName)
  4. getAttribute(Node n, String attr)
  5. getAttribute(Node n, String attr, String def)
  6. getAttribute(Node node, String att_name)
  7. getAttribute(Node node, String attName, boolean domLevel3)
  8. getAttribute(Node node, String attr)
  9. getAttribute(Node node, String attr)