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

StringgetAttribute(Element el, String attrName)
Returns the value of an attribute of an element.
String sRet = null;
Attr attr = el.getAttributeNode(attrName);
if (attr != null) {
    sRet = attr.getValue();
return sRet;
StringgetAttribute(Element el, String attrName)
Returns the value of an attribute of an element.
String sRet = null;
Attr attr = el.getAttributeNode(attrName);
if (attr != null) {
    sRet = attr.getValue();
return sRet;
StringgetAttribute(Element el, String attrName)
Returns the value of an attribute of an element.
String sRet = null;
Attr attr = el.getAttributeNode(attrName);
if (attr != null) {
    sRet = attr.getValue();
return sRet;
StringgetAttribute(Element elem, String attName, boolean mandatory)
getIntAttribute purpose.
Attr att = elem.getAttributeNode(attName);
String value = null;
if (att != null) {
    value = att.getValue();
if (mandatory) {
    if (att == null) {
        throw new SAXException(
...
StringgetAttribute(Element elem, String attName, boolean mandatory)
getIntAttribute purpose.
if (elem == null) {
    if (mandatory) {
        throw new NullPointerException();
    return "";
Attr att = elem.getAttributeNode(attName);
String value = null;
...
StringgetAttribute(Element elem, String name, String def)
get Attribute
return elem.hasAttribute(name) ? elem.getAttribute(name) : def;
StringgetAttribute(Element element, String attr)
Return the named attribute of the argument element, or null if it does not exist.
String value = element.getAttribute(attr);
if (value.equals("")) {
    value = null;
return (value);
AttrgetAttribute(Element element, String attribute)
Get an attribute from the specified Element
if (element != null)
    return element.getAttributeNode(attribute);
return null;
StringgetAttribute(Element element, String attribute, String defaultValue)
Returns the attribute value, or defaultValue if the specified element does not have the attribute.
if (element.hasAttribute(attribute))
    return element.getAttribute(attribute);
return defaultValue;
StringgetAttribute(Element element, String attributeName)
get Attribute
if (element == null) {
    return null;
String attributeValue = element.getAttribute(attributeName);
return attributeValue;