Java Utililty Methods XML Attribute Get

List of utility methods to do XML Attribute Get

Description

The list of methods to do XML Attribute Get are organized into topic(s).

Method

StringgetAttribString(Element ele, String name)
Parses the given attribute of this tag and returns it as a String.
return ele.getAttribute(name);
URLgetAttribURL(Element ele, String name, URL docRoot)
get Attrib URL
String sval = ele.getAttribute(name);
URL url;
try {
    return new URL(docRoot, sval);
} catch (Exception e) {
    return null;
StringgetAttribute(Element aElement, String aAttr, String aDefault)
Retrieves the given attribute from the given Element.
String str = getAttribute(aElement, aAttr);
return str.equals("") ? aDefault : str; 
StringgetAttribute(Element e, String attName)
get Attribute
if (e.getAttributeNode(attName) == null)
    return null;
return e.getAttribute(attName);
StringgetAttribute(Element e, String attribute)
get Attribute
if (e.hasAttribute(attribute))
    return e.getAttribute(attribute);
return null;
StringgetAttribute(Element e, String attrName, String def)
get Attribute
String result = e.getAttribute(attrName);
if (!hasValue(result))
    result = def;
return result;
StringgetAttribute(Element e, String name)
Return the value of an attribute on an element.
String value = e.getAttribute(name);
if (value != null && value.length() == 0) {
    value = null;
return value;
StringgetAttribute(Element e, String name)
Helper to get an attribute if it exists or return null.
if (e.hasAttribute(name))
    return e.getAttribute(name);
return null;
StringgetAttribute(Element e, String name)
get Attribute
return e.hasAttribute(name) ? e.getAttribute(name) : "";
StringgetAttribute(Element e, String name)
get Attribute
if (e.getAttribute(name) == null)
    return "";
return e.getAttribute(name);