Java XML Attribute Get getAttr(Node node, String name, String defaultValue)

Here you can find the source of getAttr(Node node, String name, String defaultValue)

Description

get Attr

License

Open Source License

Declaration

public static String getAttr(Node node, String name, String defaultValue) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Node;

public class Main {
    public static String getAttr(Node node, String name, String defaultValue) {
        String result = defaultValue;
        if (node != null && node.getAttributes() != null && node.getAttributes().getNamedItem(name) != null)
            result = node.getAttributes().getNamedItem(name).getNodeValue();

        return result;
    }/*from   w ww.j a va  2s  .c o  m*/
}

Related

  1. getAttr(NamedNodeMap attrs, String name)
  2. getAttr(NamedNodeMap attrs, String name, String missing_err)
  3. getAttr(Node n, String name)
  4. getAttr(Node node, String attr)
  5. getAttr(Node node, String name)
  6. getAttrBool(Node n, String name)
  7. getAttrDate(Element elem, String localName)
  8. getAttrib(NamedNodeMap attribs, String name)
  9. getAttribAsBoolean(Element e, String name, Boolean dft)