Java XML Attribute Get getAttribute(Element element, String name, String defaultVal)

Here you can find the source of getAttribute(Element element, String name, String defaultVal)

Description

get Attribute

License

Open Source License

Declaration

public static String getAttribute(Element element, String name, String defaultVal) 

Method Source Code

//package com.java2s;
// License as published by the Free Software Foundation; either

import org.w3c.dom.Element;

public class Main {
    public static String getAttribute(Element element, String name, String defaultVal) {
        if (element.hasAttribute(name)) {
            return element.getAttribute(name);
        } else {//from ww  w.  j  a  v a  2 s . c o  m
            return defaultVal;
        }
    }
}

Related

  1. getAttribute(Element element, String attrName)
  2. getAttribute(Element element, String name)
  3. getAttribute(Element element, String name)
  4. getAttribute(Element element, String name)
  5. getAttribute(Element element, String name)
  6. getAttribute(Element element, String namespace, String name)
  7. getAttribute(Element element, String nodeName)
  8. getAttribute(Element ownerElem, String attrName)
  9. getAttribute(Element parent, String localName)